📄 test3042view.cpp
字号:
// Test3042View.cpp : implementation of the CTest3042View class
//
#include "stdafx.h"
#include "Test3042.h"
#include "Test3042Doc.h"
#include "CntrItem.h"
#include "Test3042View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTest3042View
IMPLEMENT_DYNCREATE(CTest3042View, CRichEditView)
BEGIN_MESSAGE_MAP(CTest3042View, CRichEditView)
//{{AFX_MSG_MAP(CTest3042View)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
ON_WM_DESTROY()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CRichEditView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CRichEditView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRichEditView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTest3042View construction/destruction
// prototypes
int InitDriver(DWORD comemID);
DWORD closeDriver(DWORD comemID);
CTest3042View::CTest3042View()
{
DWORD comemID=0;
InitDriver(comemID); // Initialize driver
}
CTest3042View::~CTest3042View()
{
DWORD comemID=0;
TRACE("~CTest3042View(): Closing Driver...\n");
closeDriver(comemID); // Frees memory, closes driver.
}
BOOL CTest3042View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CRichEditView::PreCreateWindow(cs);
}
void CTest3042View::OnInitialUpdate()
{
CRichEditView::OnInitialUpdate();
CFont m_CFont; // display font
// LOGFONT m_lf; // display font properties
m_CFont.CreateFont(13,7,0,0,400,0,0,0,
0,1,2,
1,49,"Courier");
SetFont(&m_CFont, 0);
GetRichEditCtrl().SetReadOnly(TRUE);
// Set the printing margins (720 twips = 1/2 inch).
SetMargins(CRect(720, 720, 720, 720));
}
/////////////////////////////////////////////////////////////////////////////
// CTest3042View printing
BOOL CTest3042View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CTest3042View::OnDestroy()
{
// Deactivate the item on destruction; this is important
// when a splitter view is being used.
CRichEditView::OnDestroy();
COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
if (pActiveItem != NULL && pActiveItem->GetActiveView() == this)
{
pActiveItem->Deactivate();
ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
}
}
/////////////////////////////////////////////////////////////////////////////
// CTest3042View diagnostics
#ifdef _DEBUG
void CTest3042View::AssertValid() const
{
CRichEditView::AssertValid();
}
void CTest3042View::Dump(CDumpContext& dc) const
{
CRichEditView::Dump(dc);
}
CTest3042Doc* CTest3042View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTest3042Doc)));
return (CTest3042Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CTest3042View message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -