Solved

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

Posted on 2009-07-09
6
455 Views
Last Modified: 2012-05-07
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
0
Comment
Question by:darbid73
  • 3
  • 2
6 Comments
 
LVL 1

Accepted Solution

by:
4cruiser earned 500 total points
ID: 24811374
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
 
LVL 19

Author Comment

by:darbid73
ID: 24811380
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
 
LVL 6

Expert Comment

by:jwenting
ID: 24811447
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 19

Author Comment

by:darbid73
ID: 24811617
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
 
LVL 19

Author Closing Comment

by:darbid73
ID: 31601455
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
 
LVL 1

Expert Comment

by:4cruiser
ID: 24819410
When i make icons, i always use http://www.deviouscodeworks.co.uk/imagicon.html

Very simple to use.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

743 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