我加载了两张图片,可是在显示第二张的时候出问题了。编译通过,但是运行时弹出Debug Assertion Failed窗口,无法正常运行。代码如下:
void CInterFaceDemo2View::OnDraw(CDC* pDC)
{
   ...
   CRect rect1;
   ...//对rect1进行设置
   CBitmap bitmap;
   bitmap.LoadBitmap(IDB_BITMAP1);
   BITMAP bmp;
   bitmap.GetBitmap(&bmp);
   CDC dcCompatible;
   dcCompatible.CreateCompatibleDC(pDC);
   dcCompatible.SelectObject(&bitmap);
   pDC->StretchBlt(0,0,rect1.Width(),rect1.Height(),&dcCompatible,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);   CRect rect2;
   ...//对rect2进行设置
   bitmap.LoadBitmap(IDB_BITMAP2);
   bitmap.GetBitmap(&bmp);
   dcCompatible.SelectObject(&bitmap);
   pDC->StretchBlt(rect2.left,rect2.top,rect2.Width(),rect2.Height(),&dcCompatible,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);}