如何改变按钮文字颜色
如何改变按钮文字颜色,我用的是WM_CTLCOLOR,为什么不行,代码如下:
HBRUSH CCurrentDlg::OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor )
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if (nCtlColor==CTLCOLOR_BTN) {
pDC->SetTextColor(RGB(0,0,255));
}
return hbr;
}
或
HBRUSH CCurrentDlg::OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor )
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
UINT id=pWnd->GetDlgCtrlID();
if (id==IDOK) {
pDC->SetTextColor(RGB(0,0,255));
}
return hbr;
}
都不行,麻烦大家了,谢谢。
}