Solved

Bitmaps in menu

Posted on 2007-04-10
8
179 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
code issue 8 130
oracle global variables 4 68
Multiple image collision 13 74
Graphics32 under Delphi 10.1 Berlin 2 65
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

770 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