⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 textviewerdoc.cpp

📁 这是书上的代码
💻 CPP
字号:
// TextViewerDoc.cpp :  CTextViewerDoc 类的实现
//

#include "stdafx.h"
#include "TextViewer.h"

#include "TextViewerDoc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CTextViewerDoc

IMPLEMENT_DYNCREATE(CTextViewerDoc, CDocument)

BEGIN_MESSAGE_MAP(CTextViewerDoc, CDocument)
END_MESSAGE_MAP()


// CTextViewerDoc 构造/销毁

CTextViewerDoc::CTextViewerDoc()
{
	// TODO:在此添加一次性构造代码

}

CTextViewerDoc::~CTextViewerDoc()
{
}

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

	// TODO:在此添加重新初始化代码
	// (SDI 文档将重用该文档)

	return TRUE;
}




// CTextViewerDoc 序列化

void CTextViewerDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO:在此添加存储代码
	}
	else
	{
		// TODO:在此添加加载代码
		CString str;
		while ( ar.ReadString( str ) )
		{
			m_strContent.Add( str );	// 将行文本添加到字符串集合类对象中
		}
	}
}


// CTextViewerDoc 诊断

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

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


// CTextViewerDoc 命令

void CTextViewerDoc::DeleteContents()
{
	// TODO: 在此添加专用代码和/或调用基类
	m_strContent.RemoveAll();		// 清除集合类对象中的内容
	CDocument::DeleteContents();	// 框加自动添加的基类调用
}

⌨️ 快捷键说明

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