Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » How to set a bitmap on top of the CExtButton Collapse All
Subject Author Date
Saroj Acharya Nov 17, 2004 - 2:46 PM

Hi,


I would like to use BITMAP for the CExtButtons on my CExtControlBar (which contains dialog box). I know it is very easy to load the ICONS using the following lines of code...but not sure if there is a similar function for Bitmaps.


m_BtnStartLive.SetIcon(ID_SCPPV_NEXT);


where ID_SCPPV_NEXT is ID for the icon.


Thanks,


Saroj

Saroj Acharya Nov 17, 2004 - 3:02 PM

Also please note that the following lines of code does not work in my application:


m_BtnPrint.SetBitmap(::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_BITMAP_CAMERA)));


Thanks,


Saroj

Technical Support Nov 18, 2004 - 3:14 AM

You cannot use HBITMAP objects inside the CExtButton windows directly. But you can use HICON instead. To convert HBITMAP to HICON, the following code may be used:

HBITMAP hBmp = ...
COLORREF clrTransparentPixels = ...
CExtCmdIcon _icon( hBmp, clrTransparentPixels );
::DeleteObject( hBmp );
HICON hIcon = _icon.DetachAsHICON( false );
m_wndExtButton.SetIcon( hIcon );