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 http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_24550123.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
LVL 20
darbid73Asked:
Who is Participating?
 
4cruiserConnect With a Mentor Commented:
Try this link

http://www.msfn.org/board/transparent-bmp-s-t22523.html

it suggests Try #FF00FF, or #0000FF. as he colours, also the the pixel 0x0 needs to be the transparent colour.
0
 
darbid73Author Commented:
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
0
 
jwentingCommented:
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.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
darbid73Author Commented:
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?
0
 
darbid73Author Commented:
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.
0
 
4cruiserCommented:
When i make icons, i always use http://www.deviouscodeworks.co.uk/imagicon.html

Very simple to use.
0
All Courses

From novice to tech pro — start learning today.