ex070201doc.cpp

来自「深入浅出Visual C++入门进阶与应用实例 随书光盘 作者 何志丹」· C++ 代码 · 共 120 行

CPP
120
字号
// Ex070201Doc.cpp : implementation of the CEx070201Doc class
//

#include "stdafx.h"
#include "Ex070201.h"

#include "Ex070201Doc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CEx070201Doc

IMPLEMENT_DYNCREATE(CEx070201Doc, CDocument)

BEGIN_MESSAGE_MAP(CEx070201Doc, CDocument)
	//{{AFX_MSG_MAP(CEx070201Doc)
	ON_COMMAND(ID_INIT, OnInit)
	ON_COMMAND(ID_SHOW_1, OnShow1)
	ON_COMMAND(ID_SHOW_2, OnShow2)
	ON_COMMAND(ID_SHOW_3, OnShow3)
	ON_COMMAND(ID_SHOW_ALL, OnShowAll)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CEx070201Doc construction/destruction

CEx070201Doc::CEx070201Doc()
{
	// TODO: add one-time construction code here

}

CEx070201Doc::~CEx070201Doc()
{
}

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

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

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CEx070201Doc serialization

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

/////////////////////////////////////////////////////////////////////////////
// CEx070201Doc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CEx070201Doc commands

void CEx070201Doc::OnInit() 
{
	m_objManage.Init();	
	UpdateAllViews(NULL);
	m_objManage.WriteFile();
}

void CEx070201Doc::OnShow1() 
{
	m_objManage.ReadFile(1),
	UpdateAllViews(NULL);
}

void CEx070201Doc::OnShow2() 
{
	m_objManage.ReadFile(2),
	UpdateAllViews(NULL);
}

void CEx070201Doc::OnShow3() 
{
	m_objManage.ReadFile(3),
	UpdateAllViews(NULL);
}

void CEx070201Doc::OnShowAll() 
{
	m_objManage.ReadFile(0),
	UpdateAllViews(NULL);
}

⌨️ 快捷键说明

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