当用户选择菜单“绘图”-“点”,此时,应将用户的选择保存下来,然后根据选择的菜单进行绘图,这里,为了保存用户选择,需要有一个变量,因此,现在增加一个成员变量。
CGraphicView下的子项,多了一个m_nDrawType
双击m_nDrawType,查看其代码,如下:
// GraphicView.h : interface of the CGraphicView class
//
/
#if !defined(AFX_GRAPHICVIEW_H__504EE2A5_DDFD_49B3_8C96_70E7097FE6B5__INCLUDED_)
#define AFX_GRAPHICVIEW_H__504EE2A5_DDFD_49B3_8C96_70E7097FE6B5__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CGraphicView : public CView
{
protected: // create from serialization only
CGraphicView();
DECLARE_DYNCREATE(CGraphicView)
// Attributes
public:
CGraphicDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGraphicView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CGraphicView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CGraphicView)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
UNIT m_nDrawType;
};
#ifndef _DEBUG // debug version in GraphicView.cpp
inline CGraphicDoc* CGraphicView::GetDocument()
{ return (CGraphicDoc*)m_pDocument; }
#endif
/
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_GRAPHICVIEW_H__504EE2A5_DDFD_49B3_8C96_70E7097FE6B5__INCLUDED_)