// use CWnd::OnCtlColor
HBRUSH CSSUtilityDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
// Call the base class implementation first! Otherwise, it may
// undo what we're trying to accomplish here.
if(nCtlColor==CTLCOLOR_DLG){
HBRUSH hbr1;
// 這裡放你要的顏色 COLORREF m_curColor = RGB(255,0,0);
COLORREF m_curColor = RGB(0,0,0);
hbr1=CreateSolidBrush(m_curColor);
return hbr1;
}
}
// class define
virtual HBRUSH CSSUtilityDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) ;
//
BEGIN_MESSAGE_MAP(CSSUtilityDlg, CDialog)
…..
ON_WM_CTLCOLOR() // ADD THIS LINE
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
全站熱搜