📄 drawdoc.h
字号:
// DrawDoc.h : interface of the CDrawDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_DRAWDOC_H__27BF09BB_BC44_416C_A026_BAAD2803A517__INCLUDED_)
#define AFX_DRAWDOC_H__27BF09BB_BC44_416C_A026_BAAD2803A517__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//在这里创建一个新类CShape,专门用来存放图形坐标
class CShape:public CObject
{
protected:
int Flag;//对象图形坐标类型:1为直线,2为矩形,3为椭圆
int StartX;//图形的起点X坐标
int StartY;//图形的起点Y坐标
int EndX;//图形的终点X坐标
int EndY;//图形的终点Y坐标
CShape(){};//构造函数
DECLARE_SERIAL(CShape)//定义宏,必须在类的缺省构造函数后面
public:
CShape(int flag,int startx,int starty,int endx,int endy);//公共构造函数
void Draw(CDC *pDC);//绘制图形
virtual void Serialize(CArchive &ar);//声明系列化函数
};
class CDrawDoc : public CDocument
{
protected: // create from serialization only
CDrawDoc();
DECLARE_DYNCREATE(CDrawDoc)
CObArray m_Shape;//声明一个CObArray类对象,用于存放CShape类对象
// Attributes
public:
//增加两个成员函数AddShape和GetShape,
//用于在m_Shape添加和获取Cshape 的对象指针
void AddShape(int flag,int startx,int starty,int endx,int endy);
CShape *GetShape(int index);
virtual void DeleteContents();//声明删除函数,用于处理"新建"菜单
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDrawDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CDrawDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CDrawDoc)
// 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()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DRAWDOC_H__27BF09BB_BC44_416C_A026_BAAD2803A517__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -