OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Matching Interface Colors To System Colors

Device-independent bitmaps (DIBs) are often used to enhance and decorate a user interface.

To make your interface consistent with your application user's system, you should use TDib::MapUIColors function, which replaces standard interface colors with the user's own system colors. Here is the syntax for MapUIColors:

void MapUIColors(uint mapColors, TColor * bkColor = 0);

The mapColors parameter should be an OR'ed combination of five flags: TDib::MapFace, TDib::MapText, TDib::MapShadow, TDib::MapHighlight, and TDib::MapFrame. Each of these values causes a different color substitution to take place, as shown in the following table:

This flagReplaces...With...
TDib::MapTextTColor::BlackCOLOR_BTNTEXT
TDib::MapFaceTColor::LtGrayCOLOR_BTNFACE
TDib::MapFaceTColor::GrayCOLOR_BTNSHADOW
TDib::MapFaceTColor::WhiteCOLOR_BTNHIGHLIGHT
TDib::MapFrameTColor::LtMagentaCOLOR_WINDOWFRAME

The bkColor parameter, if specified, causes the color TColor::LtYellow to be replaced by the color bkColor.

Because MapUIColors searches for and replaces TColor table entries, this function is useful only with a DIB in RGB mode. Furthermore, because it replaces particular colors, you must design your interface using the standard system colors. For example, your button text should be black (TColor::Black), button faces should be light gray (TColor::LtGray), and so on. This should be fairly simple, since these objects are specifically designed so that they are equivalent to the standard default colors for each interface element.

You should also call the MapUIColors function before you modify any of the colors modified by MapUIColors. If you do not do this, MapUIColors will not be able to find the attribute color for which it is searching, and that part of the interface will not match the system colors.

See Also