Print Page | Close Window

CXTButtom::SetBitmap problem

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=15318
Printed Date: 16 November 2024 at 9:48pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTButtom::SetBitmap problem
Posted By: Vero
Subject: CXTButtom::SetBitmap problem
Date 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



Replies:
Posted By: rdhd
Date 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);


Posted By: Vero
Date Posted: 14 October 2009 at 1:59am
Thanks
But why? In previous codeJock versions this works perfectly!
 
Anyone else have an answer?


-------------
Vero



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net