Question

I am playing around with a small MFC-wizard-generated application, in Visual C++ 2010, and I just decided to put my own bitmap into the resources to replace the three-cubes MFC bitmap that shows up in the ribbon UI Application Button, aka the "marble".

The original appeared to use black (0,0,0) as a transparency color, but I am unable to determine what the MFC Ribbon (mfc-feature-pack stuff) stuff in Visual Studio 2010 does to determine transparency on a bitmap used as the ribbon's main icon.

The properties of the ribbon (IDR_RIBBON) show Image=IDB_MAIN, and IDB_MAIN is a 32x32 bitmap in BMP format, loaded from a disk file called main.bmp.

Some of the bitmap resources in this project have what looks like what I would expect: A magenta color which becomes transparent, but the MFC main bitmap did not use this color scheme or palette.

Here is an example of the actual results, which are I hope show that the results are not what I wanted: alt text

Incidentally, It does not seem possible to use an ICON resource in the Application Button, so I am a little mystified how they pull off the transparency in it.

Was it helpful?

Solution

Translucent PNG, perhaps? Did you know that BMP files can also have alpha channels?

OTHER TIPS

You need to create a 32-bit bitmap that has an alpha channel for transparency. The method by which I've done this is not very straightforward but it was the only thing I could come up with.

  • Use Paint.Net to convert your source image into a PNG that preserves the transparency. Unfortunately Paint.Net does not support creating 32-bit bitmaps directly.
  • Then download AlphaConv which can create the 32-bit bitmap from the PNG file.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top