Improve company productivity with a Business Account.Sign Up

x
?
Solved

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

Posted on 2009-07-09
6
Medium Priority
?
493 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 1500 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

606 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