1、从InitInstance设置应用程序默认背景和对话框颜色。
CWinApp::SetDialogBkColor
This method is called from within the InitInstance method to set the default background and text color for dialog boxes and message boxes within your application.
void SetDialogBkColor( COLORREF clrCtlBk = RGB(192, 192, 192), COLORREF clrCtlText = RGB(0, 0, 0) );eg:
CMyDlg dlg;
SetDialogBkColor(RGB(69,137,148),RGB(220,20,10));
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
2、使用OPaint设置应用程序默认背景。
CWnd::OnPaint
afx_msg void OnPaint( );
Remarks
The framework calls this member function when Windows or an application makes a request to repaint a portion of an application’s window. TheWM_PAINT message is sent when the UpdateWindow or RedrawWindow member function is called.
A window may receive internal paint messages as a result of calling the RedrawWindow member function with the RDW_INTERNALPAINT flag set. In this case, the window may not have an update region. An application should call the GetUpdateRect member function to