Colors in C++The type TColor is used to specify the color of a control. Color constants
C++ Builder contains definitions of constants for standard TColor values. These constants map either directly to the closest matching
color in the system palette (for example, clBlue maps to blue) or to the corresponding system screen element color defined in the
Color section of the Windows Control panel (for example, clBtnFace maps to the system color for button faces). Some of the color constants (only a small sample of many more that are available):
The function RGB()You can also specify a color by using the function RGB() that returns a TColor value. The function takes 3
parameters, one for red, one for green and one for red, that can range from 0 to 255. Example: Color of a componentSome code examples for setting the color of components:TColor Colr; Panel1->Color = clRed; Panel2->Color = TColor(0x006CFF6C); Panel3->Color = RGB(250, 250, 180); Colr = TColor(RGB(255, 255, 0)); Panel4->Color = Colr; You can also set the color of a Font: TColor Colr;
Colr = TColor(RGB(0, 0, 180));
Font->Color = Colr; // Font of the form
Label1->Font->Color = clBlue;
Memo1->Font->Color = TColor(RGB(0, 110, 0));
|