我想改变按钮的背景和文字顔色,请问该怎么做?HBRUSH CTest2Dlg::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() == IDOK)
pDC->SetTextColor(RGB(255,0,0));
if(nCtlColor == CTLCOLOR_BTN)
pDC->SetTextColor(RGB(255,0,0));
// TODO: Return a different brush if the default is not desired return hbr;
}
这种处理我试过了,好像对Button无效!!
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if(pWnd->GetDlgCtrlID() == IDOK)
pDC->SetTextColor(RGB(255,0,0));
if(nCtlColor == CTLCOLOR_BTN)
pDC->SetTextColor(RGB(255,0,0));
// TODO: Return a different brush if the default is not desired return hbr;
}
这种处理我试过了,好像对Button无效!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货