Background color of Dialog
-
You can go to the WM_PAINT (OnPaint()) of the dialog and add the following code CRect rect; CBrush brush(RGB(100, 0, 0)); dc.GetWindow()->GetWindowRect(&rect); ScreenToClient(&rect); dc.FillRect(&rect, &brush); dc is CPaint dc(this); Harsha ---------------------------------- http://www.ece.arizona.edu/~hpg ----------------------------------
-
One way is to override OnCtlColor(), as follows: (1) In your message map, add:
ON_WM_CTLCOLOR()
(2) Then, add the following function to your Dialog class: (replace CMyDialog with whatever is the proper name in your case)HBRUSH CMyDialog::OnCtlColor(CDC *pDC,CWnd *pWnd,UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC,pWnd,nCtlColor); if(nCtlColor == CTLCOLOR_DLG) { // Dialog background color (Blue) hbr = CreateSolidBrush(RGB(0,0,255)); return hbr; } return hbr; }
You can use this method to change the color of pretty much any element of your dialog.