?? fileserializedoc.h
字號:
// FileSerializeDoc.h : interface of the CFileSerializeDoc class
class CStroke : public CObject
{
public:
CStroke(UINT nPenWidth); //構造函數
protected:
CStroke(); //缺省構造函數,序列化要用的
DECLARE_SERIAL(CStroke) //序列化支持宏
// Attributes
public:
UINT m_nPenWidth; //筆的寬度
CArray<CPoint,CPoint> m_pointArray; //一系列連接起來的點
CRect m_rectBounding; //包含該線條的最小矩形
// Operations
public:
BOOL DrawStroke(CDC* pDC); //畫線
void FinishStroke();
CRect& GetBoundingRect() { return m_rectBounding; }
virtual void Serialize(CArchive& ar); //繼承了CObject的特性:序列化
};
class CFileSerializeDoc : public CDocument
{
protected:
// 序列化時使用
CFileSerializeDoc();
DECLARE_DYNCREATE(CFileSerializeDoc)
// Attributes
public:
UINT m_nPenWidth; // 當前用戶選擇的畫筆寬度
CPen m_penCur; // 當前用戶選擇的畫筆
BOOL m_bThickPen; // 如果是粗筆就是TRUE
UINT m_nThinWidth; // 細筆寬度
UINT m_nThickWidth; // 粗筆寬度
CSize m_sizeDoc; // 文檔的長寬大小
CTypedPtrList<CObList,CStroke*> m_strokeList; //定義了一個線條指針的鏈表
// Operations
public:
CPen* GetCurrentPen() { return &m_penCur; }
CSize GetDocSize() { return m_sizeDoc; }
CStroke* NewStroke();
void InitDocument();
void ReplacePen();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFileSerializeDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
virtual void DeleteContents();
virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CFileSerializeDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CFileSerializeDoc)
afx_msg void OnEditClearAll();
afx_msg void OnPenThickOrThin();
afx_msg void OnUpdatePenThickOrThin(CCmdUI* pCmdUI);
afx_msg void OnUpdateEditClearAll(CCmdUI* pCmdUI);
afx_msg void OnPenWidths();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -