用VC实现小型矢量图形系统的开发(下)
2008-11-13 19:31:33 来源:WEB开发网3).视图(CDrawGraphView)接收用户的对特定图形对象的操作并绘制图形对象。
classCDrawGraphView:publicCView
{
protected://createfromserializationonly
CDrawGraphView();
DECLARE_DYNCREATE(CDrawGraphView)
//Attributes
public:
CDrawGraphDoc*GetDocument();
//Operations
public:
//Overrides
//ClassWizardgeneratedvirtualfunctionoverrides
//{{AFX_VIRTUAL(CDrawGraphView)
public:
virtualvoidOnDraw(CDC*pDC);//overriddentodrawthisview
virtualBOOLPreCreateWindow(CREATESTRUCT&cs);
protected:
virtualBOOLOnPreparePrinting(CPrintInfo*pInfo);
virtualvoidOnBeginPrinting(CDC*pDC,CPrintInfo*pInfo);
virtualvoidOnEndPrinting(CDC*pDC,CPrintInfo*pInfo);
//}}AFX_VIRTUAL
//Implementation
public:
virtual~CDrawGraphView();
#ifdef_DEBUG
virtualvoidAssertValid()const;
virtualvoidDump(CDumpContext&dc)const;
#endif
protected:
//Generatedmessagemapfunctions
protected:
CPointm_ptPrev;//前面一次点击的位置
CGraph*m_curGraph;//当前正在绘制的图形对象
statebdrawbegin;//绘制状态
//{{AFX_MSG(CDrawGraphView)
afx_msgvoidOnLButtonDown(UINTnFlags,CPointpoint);
afx_msgvoidOnMouseMove(UINTnFlags,CPointpoint);
afx_msgvoidOnRButtonDown(UINTnFlags,CPointpoint);
afx_msgvoidOnLButtonDblClk(UINTnFlags,CPointpoint);
afx_msgvoidOnLButtonUp(UINTnFlags,CPointpoint);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
更多精彩
赞助商链接