drawDoc.h
资源名称:GDIUSE.rar [点击查看]
上传用户:jinlangri
上传日期:2022-07-17
资源大小:10774k
文件大小:4k
源码类别:
GDI/图象编程
开发平台:
Visual C++
- // drawDoc.h : interface of the CDrawDoc class
- //
- /////////////////////////////////////////////////////////////////////////////
- #if !defined(AFX_DRAWDOC_H__CA9C4914_07B2_11D4_B0C9_5254AB167DFC__INCLUDED_)
- #define AFX_DRAWDOC_H__CA9C4914_07B2_11D4_B0C9_5254AB167DFC__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include "stdafx.h"
- class CDrawBase : public CObject
- {
- protected:
- COLORREF m_Color; //图形颜色
- DWORD m_X1, m_Y1, m_X2, m_Y2;//包围矩形
- CDrawBase() {}
- DECLARE_SERIAL(CDrawBase) //序列化声明
- public:
- CRect GetDimRect(); //获得包围矩形
- virtual void Draw(CDC *pDC) {}
- virtual void Serialize(CArchive& ar);
- };
- class CLine : public CDrawBase
- {
- protected:
- DWORD m_Thickness; //直线的线宽
- CLine() {}
- DECLARE_SERIAL(CLine) //序列化声明
- public:
- CLine(int X1, int Y1, int X2, int Y2, COLORREF Color, int Thickness);
- virtual void Draw(CDC *pDC);
- virtual void Serialize(CArchive& ar);
- };
- class CRectangle : public CDrawBase
- {
- protected:
- DWORD m_Thickness; //矩形的线宽
- CRectangle() {}
- DECLARE_SERIAL(CRectangle) //序列化声明
- public:
- CRectangle(int X1, int Y1, int X2, int Y2, COLORREF Color, int Thickness);
- virtual void Draw(CDC *pDC);
- virtual void Serialize(CArchive& ar);
- };
- class CRectFill : public CDrawBase
- {
- protected:
- CRectFill() {}
- DECLARE_SERIAL(CRectFill) //序列化声明
- public:
- CRectFill(int X1, int Y1, int X2, int Y2, COLORREF Color);
- virtual void Draw(CDC *pDC);
- };
- class CRectRound : public CDrawBase
- {
- protected:
- DWORD m_Thickness; //圆角矩形的线宽
- CRectRound() {}
- DECLARE_SERIAL(CRectRound) //序列化声明
- public:
- CRectRound(int X1, int Y1, int X2, int Y2, COLORREF Color, int Thickness);
- virtual void Draw(CDC *pDC);
- virtual void Serialize(CArchive& ar);
- };
- class CRectRoundFill : public CDrawBase
- {
- protected:
- CRectRoundFill() {}
- DECLARE_SERIAL(CRectRoundFill) //序列化声明
- public:
- CRectRoundFill(int X1, int Y1, int X2, int Y2, COLORREF Color);
- virtual void Draw(CDC *pDC);
- };
- class CCircle : public CDrawBase
- {
- protected:
- DWORD m_Thickness; //圆的线宽
- CCircle() {}
- DECLARE_SERIAL(CCircle)//序列化声明
- public:
- CCircle(int X1, int Y1, int X2, int Y2, COLORREF Color, int Thickness);
- virtual void Serialize(CArchive& ar);
- virtual void Draw(CDC *pDC);
- };
- class CCircleFill : public CDrawBase
- {
- protected:
- CCircleFill() {}
- DECLARE_SERIAL(CCircleFill)//序列化声明
- public:
- CCircleFill(int X1, int Y1, int X2, int Y2, COLORREF Color);
- virtual void Draw(CDC *pDC);
- };
- class CText : public CDrawBase
- {
- protected:
- LOGFONT m_lf;
- CString m_String;
- CText() {}
- DECLARE_SERIAL(CText) //序列化声明
- public:
- CText(int X1, int Y1, int X2, int Y2, COLORREF Color, LOGFONT lf, CString str);
- virtual void Draw(CDC *pDC);
- virtual void Serialize(CArchive& ar);
- };
- class CDrawDoc : public CDocument
- {
- protected:
- CTypedPtrArray<CObArray, CDrawBase *> m_DrawArray;
- public:
- void AddDraw(CDrawBase *pDraw);
- CDrawBase *GetDraw(int Index);
- int GetNumDraws();
- protected: // create from serialization only
- CDrawDoc();
- DECLARE_DYNCREATE(CDrawDoc)
- // Attributes
- public:
- // Operations
- public:
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CDrawDoc)
- public:
- virtual BOOL OnNewDocument();
- virtual void Serialize(CArchive& ar);
- virtual void DeleteContents();
- //}}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)
- afx_msg void OnEditClearAll();
- afx_msg void OnUpdateEditClearAll(CCmdUI* pCmdUI);
- afx_msg void OnEditUndo();
- afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
- //}}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__CA9C4914_07B2_11D4_B0C9_5254AB167DFC__INCLUDED_)