
Transparent toolbar buttons - color of window
I figured I would post this here because I searched the news group and
was not able to find it anywhere. Maybe it will help someone
somewhere ;)
I'm using a CToolBarCtrl and I needed to create a toolbar with
transparent 256 colour buttons, ie. buttons with a background colour
COLOR_3DFACE. I tried using LoadMapped bitmap.. but that did not work
and neither did Image Lists (they could not map colours of bitmaps with
more than 16 colours). This is the code that I ended up using.. my
bitmap has 8 buttons and is 256 pixels long and 23 pixels high. This
will map the colour of the first pixel of the bitmap to COLOR_3DFACE.
HBITMAP bitmap = (HBITMAP) LoadImage(AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDB_BROWSE_TOOLBAR), IMAGE_BITMAP, 256, 23,
LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
CBitmap *cbitmap = CBitmap::FromHandle(bitmap);
m_wndToolBar.AddBitmap(8, cbitmap);
Sent via Deja.com http://www.*-*-*.com/
Before you buy.