textview.cpp

来自「这是一个PDF文件查看的程序」· C++ 代码 · 共 88 行

CPP
88
字号
// TextView.cpp : implementation of the CTextView class
//

#include "stdafx.h"
#include "PdfView.h"

#include "PdfViewDoc.h"
#include "TextView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CTextView

IMPLEMENT_DYNCREATE(CTextView, CRichEditView)

BEGIN_MESSAGE_MAP(CTextView, CRichEditView)
	ON_WM_STYLECHANGED()
END_MESSAGE_MAP()

// CTextView construction/destruction

CTextView::CTextView()
{
	// TODO: add construction code here

}

CTextView::~CTextView()
{
}

BOOL CTextView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CRichEditView::PreCreateWindow(cs);
}

void CTextView::OnInitialUpdate()
{
	CRichEditView::OnInitialUpdate();

	// TODO: You may populate your ListView with items by directly accessing
	//  its list control through a call to GetListCtrl().
	CRichEditCtrl& text = GetRichEditCtrl();
	text.SetReadOnly(1);

	CPdfViewDoc* pdoc = GetDocument();
	CBPdf& pdf = pdoc->GetPdf();
	if (!pdf.IsOpen())
		return;

	pdf.Draw(&text);
}

// CTextView diagnostics

#ifdef _DEBUG
void CTextView::AssertValid() const
{
	CRichEditView::AssertValid();
}

void CTextView::Dump(CDumpContext& dc) const
{
	CRichEditView::Dump(dc);
}

CPdfViewDoc* CTextView::GetDocument() const // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPdfViewDoc)));
	return (CPdfViewDoc*)m_pDocument;
}
#endif //_DEBUG


// CTextView message handlers
void CTextView::OnStyleChanged(int /*nStyleType*/, LPSTYLESTRUCT /*lpStyleStruct*/)
{
	//TODO: add code to react to the user changing the view style of your window
	
	Default();
}

⌨️ 快捷键说明

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