Colored Checkbox, Group box and etc

后端 未结 1 1720
星月不相逢
星月不相逢 2021-01-19 06:57

I colored static lables with this way:

case WM_CTLCOLORSTATIC:
{
    DWORD CtrlID = GetDlgCtrlID((HWND)lParam); //Window Control ID

    if(OptionColored)
           


        
相关标签:
1条回答
  • 2021-01-19 07:14

    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
        }
    
    0 讨论(0)
提交回复
热议问题