首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

按钮颜色如何没变呢

2012-01-12 
按钮颜色怎么没变呢?在OnCtlColor中的修改为:HBRUSHCVirusDlg::OnCtlColor(CDC*pDC,CWnd*pWnd,UINTnCtlCol

按钮颜色怎么没变呢?
在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了的。

热点排行