Solved

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

Posted on 2009-07-09
6
473 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 20

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 20

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 20

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
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…

752 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