当鼠标移动,绘图到DC,同时绘图到CMetaFileDC,算是备份。
重绘时把CMetaFileDC的内容弄到DC上去(最终还需要保存为文件)如果不是用GDI+的Graphics对象,而是用CDC的MoveTo和LineTo则OK代码如下:
Pen myPen2(Color(GetRValue(m_PenColor),GetGValue(m_PenColor),GetBValue(m_PenColor)),1);
Graphics myGraphics2(m_MeataFile.m_hDC);
myGraphics2.DrawLine……
重绘时把CMetaFileDC的内容弄到DC上去(最终还需要保存为文件)如果不是用GDI+的Graphics对象,而是用CDC的MoveTo和LineTo则OK代码如下:
Pen myPen2(Color(GetRValue(m_PenColor),GetGValue(m_PenColor),GetBValue(m_PenColor)),1);
Graphics myGraphics2(m_MeataFile.m_hDC);
myGraphics2.DrawLine……
if(myGraphics2.GetLastStatus()!=Ok) AfxMessageBox("Error");
弹出Error,可见构造的时候就已经失败了
下面代码有效:
MoveToEx(m_MeataFile.m_hDC,m_OldPoint.x,m_OldPoint.y,NULL);
LineTo(m_MeataFile.m_hDC,point.x,point.y);