VC绘图练习(3):编写简单的响应代码

当用户选择菜单“绘图”-“点”,此时,应将用户的选择保存下来,然后根据选择的菜单进行绘图,这里,为了保存用户选择,需要有一个变量,因此,现在增加一个成员变量。

3725039841789179761.jpg

m_nDrawType

297519050383791536.jpg

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_)

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值