singledrawdoc.cpp

来自「使用MFC编写的实现绘图功能的程序源代码」· C++ 代码 · 共 96 行

CPP
96
字号
// SingleDrawDoc.cpp : implementation of the CSingleDrawDoc class
//

#include "stdafx.h"
#include "SingleDraw.h"

#include "SingleDrawDoc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSingleDrawDoc

IMPLEMENT_DYNCREATE(CSingleDrawDoc, CDocument)

BEGIN_MESSAGE_MAP(CSingleDrawDoc, CDocument)
	//{{AFX_MSG_MAP(CSingleDrawDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSingleDrawDoc construction/destruction

CSingleDrawDoc::CSingleDrawDoc()
{
	// TODO: add one-time construction code here
	m_docSize = CSize(800, 900);	// Default size
	m_strokeList.RemoveAll();
}

CSingleDrawDoc::~CSingleDrawDoc()
{
	m_strokeList.RemoveAll();
}

BOOL CSingleDrawDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)	

	m_strokeList.RemoveAll();

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CSingleDrawDoc serialization

void CSingleDrawDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here

		// Delete the preview stroke list at first.
		if(! m_strokeList.IsEmpty()) m_strokeList.RemoveAll();
	}
	m_strokeList.Serialize(ar);
}

/////////////////////////////////////////////////////////////////////////////
// CSingleDrawDoc diagnostics

#ifdef _DEBUG
void CSingleDrawDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CSingleDrawDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CSingleDrawDoc commands

CSize & CSingleDrawDoc::GetDocSize()
{
	return m_docSize;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?