for that you need to create some CBrush data as your dialog class membrs
like
m_BlueBrush.CreateSolidBrush(RGB(0,0,255));
m_RedBrush.CreateSolidBrush(RGB(255,0,0));
m_GreenBrush.CreateSolidBrush(RGB(0,255,0));
afte that initilaize thses brushes in your OnInitDialog()
m_BlueBrush.CreateSolidBrush(RGB(0,0,255));
m_RedBrush.CreateSolidBrush(RGB(255,0,0));
m_GreenBrush.CreateSolidBrush(RGB(0,255,0));
after this in each case of your OnCtlColor() function assign these brush object to return as shown below
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if( IDC_STATIC == pWnd->GetDlgCtrlID())
{
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkColor(RGB(0,0,255));
hbr = (HBRUSH) m_GreenBrush;
}
else if( IDC_STATIC1 == pWnd->GetDlgCtrlID())
{
pDC->SetTextColor(RGB(0,255,0));
pDC->SetBkColor(RGB(0,0,255));
hbr = (HBRUSH)m_RedBrush;
}
else if( IDC_STATIC2 == pWnd->GetDlgCtrlID())
{
pDC->SetTextColor(RGB(0,0,255));
pDC->SetBkColor(RGB(0,255,0));
hbr = (HBRUSH)m_RedBrush;
}
return hbr;
take care of colour conflict with text bkgrnd...