在OnPaint()函数中else后括号内添加以下代码
CRect rect;
CPaintDC dc(this);
GetClientRect(rect);
dc.FillSolidRect(rect,RGB(66,132,217));
CDialogEx::OnPaint();
在OnPaint()函数中else后括号内添加以下代码
CRect rect;
CPaintDC dc(this);
GetClientRect(rect);
//设置背景颜色
//dc.FillSolidRect(rect,RGB(66,132,217));
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
CBitmap bmpBackground;
bmpBackground.LoadBitmapA(IDB_BITMAP_BK1);
BITMAP bitmap;
bmpBackground.GetBitmap(&bitmap);
CBitmap *pbmpOld =dcMem.SelectObject(&bmpBackground);
dc.StretchBlt(0,0,rect.Width(),rect.Height(),&dcMem,0,0,
bitmap.bmWidth,bitmap.bmHeight,SRCCOPY);
//CDialogEx::OnPaint();//添加背景图片,需注释掉