Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - CXTButtom::SetBitmap problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTButtom::SetBitmap problem

 Post Reply Post Reply
Author
Message
Vero View Drop Down
Groupie
Groupie
Avatar

Joined: 25 May 2005
Location: Spain
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote Vero Quote  Post ReplyReply Direct Link To This Post Topic: CXTButtom::SetBitmap problem
    Posted: 08 October 2009 at 4:31am
Hello,
 
I have a problem with SetBitmap in a CXTButton.  
 
I have next source:
 
m_button.SetBitmap(CSize(32,32), IDB_SAVE);
 
IDB_SAVE is a 32bpp (with alpha channel) bitmap added to my resources.

My problem is that I have the disabled button in black!

In previous versions (v9.81) this works fine! Please, can you help me?

Vero
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 886
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 13 October 2009 at 10:09am
Not familiar with v9. But you might have to load the bitmap yourself and do the following:
 

BITMAP bm = {0};

::GetObject( m_hbmImage, sizeof(bm), &bm );

CBitmap bmpIcon;

bmpIcon.Attach(m_hbmImage);// bmpIcon dtor will delete the GDI bitmap object for me

CSize iconSize(bm.bmWidth, bm.bmHeight);

// convert the bitmap to a transparent icon.

HICON hIcon = CXTPTransparentBitmap(bmpIcon).ConvertToIcon();

CXTPImageManagerIconHandle hIconHandle; // do not set equal to hIcon here or it will NOT destrory the icon

hIconHandle = hIcon; // Will call DestoyIcon - SetIcon will make a copy so that is OK;

// call SetIcon member of xtpbutton
SetIcon(iconSize, hIconHandle, CXTPImageManagerIconHandle(), FALSE);
Back to Top
Vero View Drop Down
Groupie
Groupie
Avatar

Joined: 25 May 2005
Location: Spain
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote Vero Quote  Post ReplyReply Direct Link To This Post Posted: 14 October 2009 at 1:59am
Thanks
But why? In previous codeJock versions this works perfectly!
 
Anyone else have an answer?
Vero
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.219 seconds.