Change the color of Dialog and its control

 

By using Class Wizard, add a new handler for WM_CTLCOLOR message. and write this code.

HBRUSH CColorDlgDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 

{

HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

SetTextColor(pDC->GetSafeHdc(), RGB(255, 0, 100));

return hbr;

}