Platform SDK: Windows User Interface |
The system provides default color values for buttons. An application can retrieve the default values for these colors by calling the GetSysColor function, or set the values by calling the SetSysColors function. The following table shows the default button-color values.
Value | Element colored |
---|---|
COLOR_BTNFACE | Button faces. |
COLOR_BTNHIGHLIGHT | Highlight area (the top and left edges) of a button. |
COLOR_BTNSHADOW | Shadow area (the bottom and right edges) of a button. |
COLOR_BTNTEXT | Regular (nongrayed) text in buttons. |
COLOR_GRAYTEXT | Disabled (gray) text in buttons. This color is set to 0 if the current display driver does not support a solid gray color. |
COLOR_WINDOW | Window backgrounds. |
COLOR_WINDOWFRAME | Window frames. |
COLOR_WINDOWTEXT | Text in windows. |
However, calling SetSysColors affects all applications, so you should not call this function to customize buttons for your application.
The system sends a WM_CTLCOLORBTN message to a button's parent window before drawing a button. This message contains a handle to the button's device context and a handle to the child window. The parent window can use these handles to change the button's text and background colors. However, only owner-drawn buttons respond to the parent window processing the message.