读书人

按钮颜色如何没变呢

发布时间: 2012-01-12 22:11:58 作者: rapoo

按钮颜色怎么没变呢?
在OnCtlColor中的修改为:
HBRUSH CVirusDlg::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-> SetBkMode(TRANSPARENT);
pDC-> SetTextColor(RGB(0,0,250));
pDC-> SetBkColor(RGB(0,0,250));
}

// TODO: Return a different brush if the default is not desired
return m_brush;
}
按钮颜色怎么没变啊?

[解决办法]
按钮颜色这样不会变
必须自画
[解决办法]
http://topic.csdn.net/t/20050321/12/3867830.html
[解决办法]
This approach does not work for push buttons and the CRichEditCtrl...

If you want a different color for push buttons, use a CBitmapButton
[解决办法]
道理上可以这么设置,但实际上根本行不通,不知道微软为什么这么做,还将其文档化。对于按钮,你需要自己绘制,因为按钮有很多种状态,不能这么设置就OK了的。

读书人网 >VC/MFC

热点推荐