I colored static lables with this way:
case WM_CTLCOLORSTATIC:
{
DWORD CtrlID = GetDlgCtrlID((HWND)lParam); //Window Control ID
if(OptionColored)
try playing with these messages:
WM_CTLCOLORBTN
WM_CTLCOLOREDIT
WM_CTLCOLORDLG
WM_CTLCOLORLISTBOX
WM_CTLCOLORSCROLLBAR
WM_CTLCOLORSTATIC //You are already using
I know that you need to handle WM_CTLCOLORBTN
to color check boxes but not sure which one is it for a groupbox. and it should also work for group boxes as those inherit from CButton
Also noticed in your code that you are checking for (OptionColored
), not sure what that is but you need to check if the message is targeted to your desired control to color.
so instead of checking if(OptionColored)
, you need something like:
DWORD CtrlID = GetDlgCtrlID((HWND)lParam));
if (CtrlID == IDC_STATIC1) //If desired control
{
//Color my STATIC CONTROLE
}