By messaging WM_CTLCOLOR we can change the background color of the dialog or some special controls, add the WM_CTLCOLOR message mapping. 2, in CWnd :: ONCTLCOLOR as the corresponding processing HRESULT CWND :: ONCTLCOLOR (CDC * PDC, CWND * PWND, UINT NCTLCOLOR) {switch (nctlcolor) {copy ctelcolor_btn: // button control {PDC-> setbkcolor (RGB (RGB) 255, 0, 0));} Break; Case CTLCOLOR_DLG: // Dialog Box Break; Case CTLCOLOR_EDIT: // Edit Control {ColorRef Bkcolor = RGB (255, 0, 0); CRECT Rect; PWND-> getClientRect (& Rect) ; CBrush br; br.CreateSolidBrush (bkColor); pDC-> FillRect (rect, & br); * / pDC-> SetBkColor (bkColor);} break; case CTLCOLOR_LISTBOX: // List-box control break; case CTLCOLOR_MSGBOX: // Message Box Break; Case CTLCOLOR_SCROLLBAR: // Scroll-Bar Control Break; Case CTLCOLOR_STATIC: // Static Control Break; default: Break;} Ret URN CWND :: ONCTLCOLOR (PDC, PWND, NCTLCOLOR);