// TODO: Change any attributes of the DC here
switch (nCtlColor)
{
case CTLCOLOR_DLG:
HBRUSH aBrush;
aBrush = CreateSolidBrush(RGB(0, 150, 0));
hbr = aBrush;
break;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
这样 为对话框着色就可以实现了。
二、给MFC添加背景图图片代码:
定位到 void CXXXDlg::OnPaint(),在if()...else()中的else()下添加如下代码:
//CDialog::OnPaint();//要禁止这个调用
CPaintDC dc(this);
CRect rect;
GetClientRect(&rect);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
CBitmap bmpBackground;
bmpBackground.LoadBitmap(IDB_BITMAP);
//IDB_BITMAP是你自己的图对应的ID