Solved

Bitmaps in menu

Posted on 2007-04-10
8
178 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
Comment Utility
How you loading bitmaps?
0
 

Author Comment

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

Expert Comment

by:arioh
Comment Utility
try to use LoadImage() with LR_LOADTRANSPARENT flag
0
 

Author Comment

by:shaguard
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 9

Accepted Solution

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

Author Comment

by:shaguard
Comment Utility
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
Comment Utility
sorry, no experience yet :)
0
 

Author Comment

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

Shaguard
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now