void CMyView::OnDraw(CDC* pDC) 
{
// TODO: Add your specialized code here and/or call the base class
CMyDoc* pDoc=(CMyDoc*)GetDocument(); CDC *MemDC;//定义内存中的显示设备对象
CBitmap MemBitmap;//定义位图对象
int nWidth=m_midRect.right-m_midRect.left;
int nHeight=m_midRect.bottom-m_midRect.top; MemDC->CreateCompatibleDC(pDC);//建立与屏幕显示兼容的内存显示设备
MemBitmap.CreateCompatibleBitmap(pDC,nWidth,nHeight);//建立与屏幕显示兼容的位图
CBitmap *pOldBit=MemDC->SelectObject(&MemBitmap);//将位图选入到内存显示设备中
              。
              。
              。 //将内存中的图拷贝到屏幕上进行显示
pDC->BitBlt(m_midRect.left,m_midRect.top,m_midRect.right,m_midRect.bottom,MemDC,0,0,SRCCOPY);
// pDC->BitBlt(m_midRect.left,m_midRect.top,nWidth,nHeight,MemDC,0,0,SRCCOPY);
//绘图完成后的清理
MemBitmap.DeleteObject();
MemDC->DeleteDC();
}
Build之后出现:
warning C4700: local variable 'MemDC' used without having been initialized
运行后出现:
Debug Assertion Failed!....请问是什么原因造成的?如何解决?