CBrush m_brushColor;2.在onInitDialog()初始化时创建画刷,并设置实际的颜色:
m_brushColor.CreateSolidBrush ( RGB ( 100, 100, 255 ));//初始化颜色画刷3.通过类向导添加afx_msg HBRUSH onCtlColor()函数,并返回颜色刷子:
HBRUSH CxxxDlg::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_DLG) return m_brushColor; //返回颜色刷子 }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)