Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Using PNG with CXTButton?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Using PNG with CXTButton?

 Post Reply Post Reply
Author
Message
loqqus View Drop Down
Newbie
Newbie


Joined: 22 August 2006
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote loqqus Quote  Post ReplyReply Direct Link To This Post Topic: Using PNG with CXTButton?
    Posted: 24 August 2006 at 4:40am
Is it possible to use a PNG with CXTButton instead of a bmp or ico? For example, in the Button Sample project, replace the bmps with pngs.

If so, which member fn should I call, or do I need to convert the png to bmp?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 24 August 2006 at 8:54am
Hi,
 
Add Png file ro resources, load it
 
 BOOL bAlphaBitmap = FALSE;
HBITMAP hBitmap = CXTPImageManagerIcon::LoadBitmapFromResource(MAKEINTRESOURCE(nID), &bAlphaBitmap);
 
CXTPImageManagerIconHandle hIconHandle;
hIconHandle = hBitmap;  // Will call DeleteObject;
and call
btn.SetIcon(size, hIconHandle, CXTPImageManagerIconHandle(), TRUE);
 
 
 
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
loqqus View Drop Down
Newbie
Newbie


Joined: 22 August 2006
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote loqqus Quote  Post ReplyReply Direct Link To This Post Posted: 25 August 2006 at 12:18am
Perfect! Works great -- Many thanks!
Back to Top
Hmbucker View Drop Down
Newbie
Newbie


Joined: 12 October 2012
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hmbucker Quote  Post ReplyReply Direct Link To This Post Posted: 12 October 2012 at 4:00am
That shows the png alright, but it looses the skinning of the button???
So I guess the only possible solution is to derive a button call CButton::OnPaint(); and then draw your own png right?
A bit a pity though, as I would expect such an expensive tool to do that for me...
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.031 seconds.