Link to home
Start Free TrialLog in
Avatar of darbid73
darbid73Flag for Germany

asked on

Getting the .BMP image right for a transparent image on the CommandBar

Ok so I have found different methods of doing this and more information on the type of BMP that can be used.

I am using this method here http://www.codeguru.com/vb/gen/vb_general/idelanguage/article.php/c3237 which seems a lot simplier than Microsofts version.

I am able to get the bmp on the command bar but still have the same problem with the transparency.

I say still because I had a random problem with a different method and languages which I have no idea how to solve https://www.experts-exchange.com/questions/24550123/MS-Office-Command-Bar-button-image-Transparency-problem.html.

In this thread http://www.eggheadcafe.com/forumarchives/officedevelopercomadd_ins/Sep2005/post23657712.asp someone else reports that if you use a resource (which is what I have done) that the background color sometimes does not work but does not resolve the issue.

Here is what microsoft says
"In order to remain compatible with current Office guidelines, the bitmap image you use for a custom CommandBarButton picture should be a 256-color device independent bitmap (DIB) no bigger than 16 x 16 pixels in size. You can use any graphics editor to create these bitmaps, provided that it can save images as a standard Windows bitmap (.bmp or .dib) file, but be sure not to use high-color images because these may appear distorted on some systems with lower resolution. Also, choose a color that is not likely to appear in your main images, such as magenta (RGB(255, 0, 255)), and use it to fill in those areas that you want to make transparent."

But here is my main question http://msdn.microsoft.com/en-us/library/bb787467(VS.85).aspx

At the bottom of the above link it has this

"The documentation for CreateMappedBitmap() is missing a critical piece of information. Although this function will load 256-color bitmaps, only the first 16 entries in the palette will be updated based on lpColorMap. Therefore, any colors you want to update must appear as one of the first 16 palette entries."

How do I do that with my bmp which I have added to this post?
How do I make a color one of the first 16 entries or how do I find out what colors are in the first 16 entries?

O2LTT2I.bmp
ASKER CERTIFIED SOLUTION
Avatar of 4cruiser
4cruiser

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
Avatar of darbid73

ASKER

I actually have my original .ico file which I will add as well.  I got my 16x16 256 colors from one of them.  I have to zip it as an .ico is not accepted.

LuTTool.zip
just rename .ico to .bmp. Icon files are bmp files with specific size and colour debt requirements (256 colours, VGA standard pallette).

Used to be that the first pixel in a icon file was considered the transparent colour. Not sure if that's still the case.
jwenting - Ok pretty sure renaming the .ico does not work.  If the bmp contains anything more than 256 colors it will not load into the office program.

4cruiser - I have made the top left pixel the color that I want transparent - I am using 255,0,255 which is one of the colors that Windows uses and in that post you gave me.

It still does not work.

The only thing I can assist with this is that if I use the same image but the 16 colors version (the ico has all in it) it works.

I am pretty sure the key to this is that my either my BMP is not an INDEXED 256 color image or that one of the 1st 16 colors in the palette which is an option part of a .bmp file is not 255,0,255.

Any help on how to check these two things?
I appreciate the link.  I cannot confirm if the link is 100% correct as it did not help me.  But the link sounds right and I have nothing to say that it is incorrect that points awarded.  For me I took a different path and made a second picture which is a black mask and masked the image.
Avatar of 4cruiser
4cruiser

When i make icons, i always use http://www.deviouscodeworks.co.uk/imagicon.html

Very simple to use.