①在CExampleDlgDlg的头文件中,添加一CBrush的成员变量:  
class   CExampleDlgDlg   :   public   CDialog
{...
protected:
CBrush   m_brush;  
...
};
----   ②在OnInitDialog()函数中添加如下代码:  
BOOL   CExampleDlgDlg::OnInitDialog()  
{
...
//   TODO:   Add   extra   initialization   here
m_brush.CreateSolidBrush(RGB(0,   255,   0));   //   生成一绿色刷子  
...
}  
----   ③利用ClassWizard重载OnCtlColor(…),即WM_CTLCOLOR消息:  
HBRUSH   CExampleDlgDlg::OnCtlColor
(CDC*   pDC,   CWnd*   pWnd,   UINT   nCtlColor)  
{
/*
**   这里不必编写任何代码!
**下行代码要注释掉
**   HBRUSH   hbr   =   CDialog::OnCtlColor(pDC,   pWnd,   nCtlColor);
*/
return   m_brush;       //返加绿色刷子
}

相关文章:

  • 2022-03-08
  • 2022-12-23
  • 2021-10-30
  • 2022-12-23
  • 2021-07-22
  • 2022-12-23
  • 2021-09-12
  • 2021-07-06
猜你喜欢
  • 2022-12-23
  • 2021-07-19
  • 2022-12-23
  • 2022-12-23
  • 2022-01-04
  • 2021-12-27
  • 2022-12-23
相关资源
相似解决方案