BOOL CMyView::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
CBitmap m_bitmap;
BITMAP stBitmap;
CRect rectbk;
GetClientRect(&rectbk);
//m_bitmap.Attach(hbmp);
m_bitmap.LoadBitmap(IDB_BITMAP57);
m_bitmap.GetObject(sizeof(BITMAP),&stBitmap);
CSize bmsize(stBitmap.bmWidth,stBitmap.bmHeight);
CDC dcMemory;
dcMemory.CreateCompatibleDC(pDC);
dcMemory.SelectObject(&m_bitmap);
pDC->StretchBlt(rectbk.left,rectbk.top,rectbk.Width(),rectbk.Height(),&dcMemory,0,0,bmsize.cx,bmsize.cy,SRCCOPY);
//dcMemory.SelectObject(pOldBitmap);
m_bitmap.Detach();
m_bitmap.DeleteObject();
dcMemory.DeleteDC();
ReleaseDC(&dcMemory);
ReleaseDC(pDC);
return true;
return CView::OnEraseBkgnd(pDC);
}
多次变换窗口大小 程序就自动关闭了 为什么????怎么解决~