Time ago I was playing with this, just add a small image to te left of the menÃÆ'Ã,º text. The problem is the background of the image, it is supposed that it should be transparent, but instead appears in black color, perhaps someone can see why.
BTW, it's a full winapi thing...
Looks fine to me.
Larry
Looks perfectly well on my Laptop (Thinkpad T60)
Haim
Sorry for not having been more precise in my initial enquiry. The problem only happen when the mouse is over an item.
Hello,
Even with the mouse over an item the icon is transparent.
I do not percieve any problem...
Haim
Subroutine MenuitDraw - change the operator (from = to &)IF *<DRAWITEMSTRUCT>lParam.itemState & ODS_SELECTED
Subroutine ImageTranspCreate, MenuOwnerDrawAux - GDI memory leaks in SelectObject calls. You should save what the first SelectObject returns, and select it back before returning or deleting the HDC.
sub ImageTranspCreate
...
int old, old2
old = _SelectObject(hdcMem, hbmColour) ' save old HBITMAP
old2 = _SelectObject(hdcMem2, hbmMask) ' save old HBITMAP
...
_SelectObject(hdcMem, old) ' restore old HBITMAP
_SelectObject(hdcMem2, old2) ' restore old HBITMAP
_DeleteDC(hdcMem)
_DeleteDC(hdcMem2)
...
By the way instead, creating the mask, you could use TransparentBlt api (ncluded in Windows 98 and later) to draw your bitmaps transparently. It takes the pixel color to be transparent, two HDC, source and destination rectangles.
Take a look at Office Menu topic.
Hi, I found it strange that does not work, because the same procedure in other controls worked well, thanks for warning me, it's only a local problem :).
Sapero, thanks for the corrections, the function TransparentBlt sounds promising, I will consider it in these days, and i will try to add checkbox and radios in the menus.