Solved

Bitmaps in menu

Posted on 2007-04-10
8
181 Views
Last Modified: 2010-04-05
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
0
Comment
Question by:shaguard
  • 4
  • 4
8 Comments
 
LVL 9

Expert Comment

by:arioh
ID: 18887161
How you loading bitmaps?
0
 

Author Comment

by:shaguard
ID: 18887177
LoadBitmap() from a compiled resource, 1 at a time.
0
 
LVL 9

Expert Comment

by:arioh
ID: 18887220
try to use LoadImage() with LR_LOADTRANSPARENT flag
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:shaguard
ID: 18887849
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
0
 
LVL 9

Accepted Solution

by:
arioh earned 500 total points
ID: 18888096
try LR_LOADTRANSPARENT + LR_CREATEDIBSECTION
if no success - maybe you can post a code?
0
 

Author Comment

by:shaguard
ID: 18896363
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
0
 
LVL 9

Expert Comment

by:arioh
ID: 18896947
sorry, no experience yet :)
0
 

Author Comment

by:shaguard
ID: 18904090
Thanks much arioh, I have accepted your answer since it does do what I originally asked.

Shaguard
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi component that can load a DLL in design time? 8 72
Internet Explorer View Settings Question 15 116
Delphi - replicating a form 8 81
Delphi Yen format 3 45
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used.

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question