添加消息:ON_WM_CTLCOLOR()
//在OnInitDialog()方法中添加{HWND hSatateWnd = GetDlgItem(IDC_CHK)->GetSafeHwnd();SetWindowTheme(hSatateWnd, _T(""), _T(""));}
头文件中:
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{HBRUSH hbr = CXTResizeDialog::OnCtlColor(pDC, pWnd, nCtlColor);// TODO: 在此更改 DC 的任何特性if (pWnd->GetDlgCtrlID() == IDC_CHK)// 设置文本颜色pDC->SetTextColor(RGB(255, 0, 0));}//TODO:如果默认的不是所需画笔,则返回另一个画笔return hbr;
}