ON_WM_CTLCOLOR =>
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
Example Code :
HBRUSH CResolutionCenterClientUIDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// assume white brush
hbr = (HBRUSH)::GetStockObject(WHITE_BRUSH);
int nCtrlID = pWnd->GetDlgCtrlID() ;
switch(nCtrlID)
{
case IDC_ST_START_LOGGING:
case IDC_ST_GEN_REPORT:
pDC->SetBkMode(TRANSPARENT);
hbr = (HBRUSH)::GetStockObject(HOLLOW_BRUSH);
break ;
case IDC_START_LOGGING:
case IDC_GEN_REPORT:
pDC->SetBkMode(TRANSPARENT);
hbr = (HBRUSH)::GetStockObject(HOLLOW_BRUSH);
break ;
case IDC_ST_STATUS:
pDC->SetTextColor(TEXT_DARK_BLUE_COLOR);
pDC->SetBkColor(TEXT_WHITE_BGND_COLOR);
break ;
case IDC_ST_LOG_DESC:
case IDC_ST_GEN_RPT:
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(TEXT_WHITE_BGND_COLOR) ;
hbr = (HBRUSH)::GetStockObject(HOLLOW_BRUSH);
break ;
}
return hbr;
}