Vidar Hasfjord - 2011-08-31

Note that TColor::LtGray == RGB(192, 192, 192); and TColor::Gray == RGB(128, 128, 128).

The mapping of the transparent color happens in TDib::MapUIColors. Here TColor::LtGray (not TColor::Gray!) in the source bitmap is mapped to TColor::Sys3dFace, which is the transparent color used by TButtonGadget::PaintFace:

..TUIFace face(rect, celArray, TColor::Sys3dFace);

At this point celArray should have been built by TButtonGadget::BuildCelArray, which calls TButtonGadget::GetGlyphDib, which in turn calls TDib::MapUIColors.

BuildCelArray is called by TButtonGadget::GetDesired as part of setup, as well as by TButtonGadget::SysColorChange in response to GUI color changes.

Set a break-point in your code in this code path to debug your code and identify the problem. Please retest with the latest version, and post complete example code demonstrating the problem if it still persists.