Button Color Messages

Windows provides default color values for buttons. The system sends a WM_CTLCOLORBTN message to a button's parent window before the button is drawn. This message contains a handle of the button's device context and a handle of the child window. The parent window can use these handles to change the button's text and background colors. Default button-color values are described in the following table.

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 text in buttons.
COLOR_GRAYTEXT In buttons, disabled text appears dimmed. 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.

An application can retrieve the default values for these colors by calling the GetSysColor function, or it can set the values by calling the SetSysColors function.