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 General Discussion » how could i attach a bitmap to a CExtButton and show it ? Collapse All
Subject Author Date
violet zhu Apr 6, 2005 - 4:12 AM

how could i attach a bitmap to a CExtButton and show it ?


 

Technical Support Apr 7, 2005 - 2:08 AM

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

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