Knowledge Base Nr: 00319 ctrlcolor.cpp - http://www.swe-kaiser.de
Downloads:
MFC: farben für einzelne controls in dialogen ändern
mit classwizzard ereignishandler für WM_CTLCOLOR hinzufügen:
BEGIN_MESSAGE_MAP(NewRaster, CPropertyPage)
...
ON_WM_CTLCOLOR()
END_MESSAGE_MAP()
public:
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
HBRUSH NewRaster::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
if (pWnd->GetDlgCtrlID() == IDC_BAUGROESSEN)
{
pDC->SetBkColor(m_bSelectEnabled ? RGB(255,255,255) : ::GetSysColor(COLOR_BTNFACE));
}
return hbr;
}