CDialog可以通过重载PreCreateWindow来改变Dialog的背景色吗?
我这样做了但是不行,不过通过这种方法修改过视类的背景色!
BOOL CMyDlg::PreCreateWindow(CREATESTRUCT& cs)
{
WNDCLASSEX wcex;
wcex.cbSize= sizeof(WNDCLASSEX);
wcex.style= CS_VREDRAW | CS_HREDRAW;
wcex.lpfnWndProc= ::DefWindowProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra= 0;
wcex.hInstance= AfxGetInstanceHandle();
wcex.hIcon= LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME));
wcex.hCursor= LoadCursor(NULL, IDC_ARROW);
wcex.lpszMenuName= NULL;
wcex.lpszClassName= _T("BGTest");
wcex.hIconSm=LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME));
HBRUSH hBrush=CreateSolidBrush(RGB(0xFF, 0, 0)); wcex.hbrBackground= hBrush;
RegisterClassEx(&wcex);
cs.lpszClass = wcex.lpszClassName;
return CMdlg::PreCreateWindow(cs);
}