请各位大侠帮帮忙,怎么才能改变checkbox控件的背景颜色

解决方案 »

  1.   

    在OnCtrlColor函数中,判断控件ID.然后改变背景就可以了.
      

  2.   

    HBRUSH CGgDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
    {
    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);// TODO: Change any attributes of the DC here
    if((pWnd->GetDlgCtrlID()==IDC_CHECK1/*换成你的复选框的ID*/))
    {
    pDC->SetBkMode(TRANSPARENT); 
    return HBRUSH(GetStockObject(HOLLOW_BRUSH));
    }
    // TODO: Return a different brush if the default is not desired
    // TODO: Return a different brush if the default is not desired
    return hbr;
    }