vc对话框显示位图正常,但是最小化后重新显示出错。
对话框的onpaint()里面添加如下代码CPaintDCdc(this);cBmp.LoadBitmap(IDB_MAINPIC);CDCdcCompatible;BI...
对话框的onpaint()里面添加如下代码
CPaintDC dc(this);
cBmp.LoadBitmap(IDB_MAINPIC);
CDC dcCompatible;
BITMAP bmp;
cBmp.GetBitmap(&bmp);
dcCompatible.CreateCompatibleDC(&dc);
CBitmap *pOldBmp=dcCompatible.SelectObject(&cBmp);
CRect rctPicture;
m_picture.GetWindowRect(&rctPicture);
dc.StretchBlt(rctPicture.left,rctPicture.top-22,rctPicture.Width(),rctPicture.Height(),&dcCompatible,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);
dcCompatible.SelectObject(pOldBmp);
将对话框最小化,然后再最大化显示就出现如图错误。
如图 展开
CPaintDC dc(this);
cBmp.LoadBitmap(IDB_MAINPIC);
CDC dcCompatible;
BITMAP bmp;
cBmp.GetBitmap(&bmp);
dcCompatible.CreateCompatibleDC(&dc);
CBitmap *pOldBmp=dcCompatible.SelectObject(&cBmp);
CRect rctPicture;
m_picture.GetWindowRect(&rctPicture);
dc.StretchBlt(rctPicture.left,rctPicture.top-22,rctPicture.Width(),rctPicture.Height(),&dcCompatible,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);
dcCompatible.SelectObject(pOldBmp);
将对话框最小化,然后再最大化显示就出现如图错误。
如图 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询