📄 docviewdoc.cpp
字号:
// DocViewDoc.cpp : implementation of the CDocViewDoc class
//
#include "stdafx.h"
#include "DocView.h"
#include "DocViewDoc.h"
#include "Line.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDocViewDoc
IMPLEMENT_DYNCREATE(CDocViewDoc, CDocument)
BEGIN_MESSAGE_MAP(CDocViewDoc, CDocument)
//{{AFX_MSG_MAP(CDocViewDoc)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CDocViewDoc construction/destruction
CDocViewDoc::CDocViewDoc()
{
// TODO: add one-time construction code here
}
CDocViewDoc::~CDocViewDoc()
{
}
BOOL CDocViewDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CDocViewDoc serialization
void CDocViewDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CDocViewDoc diagnostics
#ifdef _DEBUG
void CDocViewDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CDocViewDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CDocViewDoc commands
void CDocViewDoc::DrawLine(CDC *pDC)
{
CLine *pLine;
POSITION pos = m_LineList.GetHeadPosition();
for(; pos != NULL; m_LineList.GetNext(pos))
{
pLine = (CLine *) m_LineList.GetAt(pos);
pLine->Draw(pDC);
}
}
void CDocViewDoc::DrawText(CDC *pDC)
{
TEXTMETRIC tm;
pDC->GetTextMetrics(&tm);
int nLineHeight = tm.tmHeight + tm.tmExternalLeading;
CString str;
int line = 0;
POSITION pos = m_strList.GetHeadPosition();
for( ; pos != NULL; m_strList.GetNext(pos) )
{
str = m_strList.GetAt(pos);
pDC->TextOut( 0, line*nLineHeight, str );
line++;
}
pDC->TextOut( 0, line*nLineHeight, m_strLastLine );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -