Link to home
Start Free TrialLog in
Avatar of shaguard
shaguard

asked on

Bitmaps in menu

I'm building a program from Windows API only in delphi and I am needing to create a popupmenu with images in it. I need help drawing the images in rows of 4 or 5 and the background color should be transparent. The bitmaps mask is what delphi considers the clFuchsia color which looks purple like many other Windows bitmaps. Any help with this? I would prefer the menu to not use the graphics unit or menus unit so what i am meaning is no VCL just windows API. I'm failing to make the bitmaps bgcolor transparent so this is what I am here.

TIA,
Shaguard
Avatar of arioh
arioh
Flag of Russian Federation image

How you loading bitmaps?
Avatar of shaguard
shaguard

ASKER

LoadBitmap() from a compiled resource, 1 at a time.
try to use LoadImage() with LR_LOADTRANSPARENT flag
It makes it work mostly but I still notice that there's some minor trim around the image and when you select over each image it draws a new color over the menu items, is there any way to stop that? Something like SetBkColor for menus so that the new menu items always match the background color of the popupmenu?

TIA,
Shaguard
ASKER CERTIFIED SOLUTION
Avatar of arioh
arioh
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I've tried virtually all possible flags with LoadImage and it's the same result which is the image background is not the correct color of COLOR_WINDOW I guess is what it would be for transparent. I believe I am in need of having to do grunt work myself with actual bitmap image and setup mask and handle raw HDC to get the result I need. Do you have any experience with TransparentBlt because I have seen some example codes do this?

TIA,
Shaguard
sorry, no experience yet :)
Thanks much arioh, I have accepted your answer since it does do what I originally asked.

Shaguard