CColor( Hwnd, Background = "", Foreground = "" )
Set text and background color for some Gui controls. Supported types: Edit, Text, ListBox, ComboBox, DropDownList, CheckBox, RadioButton, ListView, TreeView, RichEdit
Hwnd | Handle of the control. |
Background | Background color. HTML color name or 6-digit RGB value. Optional. |
Foreground | Foreground color. HTML color name or 6-digit RGB value. Optional. |
You need to redraw the window for changes to take effect. For some controls, it may be needed to explicitelly specify foreground color (“cRed”) when creating control, otherwise text will stay black.
On tha first call for a specific control class the function registers itself as message handler for WM_CTLCOLOR message of appropriate class.
Buttons are always drawn with the default system colors. Drawing buttons requires several different brushes-face, highlight and shadow but the WM_CTLCOLORBTN message allows only one brush to be returned. To provide a custom appearance for push buttons, use an owner-drawn button.