testappdoc.cpp
来自「学习VC的一些例子」· C++ 代码 · 共 108 行
CPP
108 行
// TestAppDoc.cpp : implementation of the CTestAppDoc class
//
#include "stdafx.h"
#include "TestApp.h"
#include "ModArt.h"
#include "TestAppDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTestAppDoc
IMPLEMENT_DYNCREATE(CTestAppDoc, CDocument)
BEGIN_MESSAGE_MAP(CTestAppDoc, CDocument)
//{{AFX_MSG_MAP(CTestAppDoc)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CTestAppDoc construction/destruction
CTestAppDoc::CTestAppDoc()
{
// TODO: add one-time construction code here
}
CTestAppDoc::~CTestAppDoc()
{
}
BOOL CTestAppDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
// Get the position of the view
POSITION pos = GetFirstViewPosition();
// Did we get a valid position?
if (pos != NULL)
{
// Get a pointer to the view
CView * pView = GetNextView(pos);
RECT lWndRect;
// Get the display area rectangle
pView->GetClientRect(&lWndRect);
// Set the drawing area
m_maDrawing.SetRect(lWndRect);
// Create a new drawing
m_maDrawing.NewDrawing();
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CTestAppDoc serialization
void CTestAppDoc::Serialize(CArchive& ar)
{
m_maDrawing.Serialize(ar);
}
/////////////////////////////////////////////////////////////////////////////
// CTestAppDoc diagnostics
#ifdef _DEBUG
void CTestAppDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CTestAppDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTestAppDoc commands
void CTestAppDoc::DeleteContents()
{
// TODO: Add your specialized code here and/or call the base class
m_maDrawing.ClearDrawing();
CDocument::DeleteContents();
}
CModArt * CTestAppDoc::GetDrawing()
{
return &m_maDrawing;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?