1
votes

I want to use some of these bitmaps on the MS Office Ribbon control, basically like:

ribbon:RibbonButton x:Name="btnCollapsed" SmallImageSource="Images\Collapsed.bmp"

The following is from: VS2010ImageLibrary\Objects\bmp_format\Office and VS_MSObjects_24bitColor_bmp_OfficeVS - Readme.html

"Visual Studio Image Library: Objects (24-Bit, .bmp Format, Office and Visual Studio style)

24-Bit Art This art is 24-bit color. Transparency should be achieved by mapping RGB:255,0,255 to the background color of the UI."

I am trying to use the VS 2010 Image Editor but can't figure out what I need to do. I am guessing I need to save the bmp as PNG but what else? I could manually change the RGB:255,0,255 of each bitmap I need to the pale blue background of the ribbon but I think there should be a simpler technique (e.g., like specifying what the transparent color is)

Any help greatly appreciated.

2

2 Answers

2
votes

That's Color.Fuchsia. It's a great fuchsed-up color that is very unlikely to ever be used in a bitmap. Very commonly used in old C/C++ user interface code to make 24-bpp bitmaps, a format that doesn't support transparency, into bitmaps that behave like they do. I'll spare you the C code that's required to make that work, it's quite fuchsed-up.

A lot of the bitmaps that are in the image library came from internal Microsoft projects that used this trick. Big chunks of Windows are still native C++ code that uses the raw Win32 api, GDI doesn't support transparency at all so 24-bpp was common.

You'd need a decent graphics editor, the first order of business is to turn it into a 32-bpp bitmap. Then color-replace. I'd personally use a quicky .NET program that uses Bitmap.MakeTransparent(), draw to a 32-bpp bitmap and save that as a .png

0
votes

You need to convert the images to PNG with proper alpha transparency as WPF does not provide color key transparency functions without resorting to WritableBitmaps or custom BitmapSources.

This application can convert your bmps to proper transparent PNGs by selecting the Magenta color key: http://transparentpng.codeplex.com/releases/view/54303