From: Chris Becke on
On 04/04/2010 17:17, Carl Colijn wrote:
> Carl Colijn wrote:
>> Hi group,
>> I hit upon a problem I can't explain. I have a dialog on which I
>> placed a static control with the SS_BITMAP style. On run-time I load
>> a bitmap with the LoadImage function and show it in the control with
>> the STM_SETIMAGE message. I also include a manifest file to make the
>> app use Common Controls version 6, thus enabling Windows XP themes.
>> I run this app on a Windows XP SP3 machine.
>> When I save the bitmap with a full palette all shows OK, but when I
>> only add the needed colors in the bitmap's palette (say e.g. a palette
>> of only 3 colors) one of the colors in the bitmap shows
>> "transparent"...?! By removing the manifest the bitmap with the
>> reduced palette will also show OK. To remove unused colors from the
>> palette I used the Gimp.
>> What could be the cause of this? Is it the theme support in XP that
>> acts wrong / "special" with these bitmaps, or is the saved bitmap
>> corrupt in some way? (corrupt being either really corrupt or not
>> conforming to some Windows UI guidelines I'm unaware of.)
> To answer my own post: the bitmap was loaded via LoadImage with the
> flag LR_CREATEDIBSECTION. When the flag LR_DEFAULTCOLOR is used, the
> problem goes away. Appearantly the bitmaps with the special behavior
> didn't result in a compatible bitmap of sorts? I'm still interested in
> the exact reason for this if someone wants to elaborate on it, but the
> problem has been resolved.
Looking at the bitmaps bits, they both seem to 100% legitimate bitmaps.

I can only imagine that the static control for version 6 common controls
has a bug in its transparency detection logic - rather than checking the
number of bits of color depth they do an explicit number_of_colors == 16

At any rate, the version 6 static control is meant (per comments in
MSDN) check and process images with alpha to draw them correctly. This
would seem to be failing when passed a bitmap with a relatively novel