ex010206view.cpp
来自「深入浅出Visual C++入门进阶与应用实例 随书光盘 作者 何志丹」· C++ 代码 · 共 111 行
CPP
111 行
// Ex010206View.cpp : implementation of the CEx010206View class
//
#include "stdafx.h"
#include "Ex010206.h"
#include "Ex010206Doc.h"
#include "CntrItem.h"
#include "Ex010206View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEx010206View
IMPLEMENT_DYNCREATE(CEx010206View, CRichEditView)
BEGIN_MESSAGE_MAP(CEx010206View, CRichEditView)
//{{AFX_MSG_MAP(CEx010206View)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CEx010206View construction/destruction
CEx010206View::CEx010206View()
{
// TODO: add construction code here
}
CEx010206View::~CEx010206View()
{
}
BOOL CEx010206View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CRichEditView::PreCreateWindow(cs);
}
void CEx010206View::OnInitialUpdate()
{
CRichEditView::OnInitialUpdate();
// Set the printing margins (720 twips = 1/2 inch).
SetMargins(CRect(720, 720, 720, 720));
}
/////////////////////////////////////////////////////////////////////////////
// CEx010206View printing
BOOL CEx010206View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CEx010206View::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);
}
}
/////////////////////////////////////////////////////////////////////////////
// CEx010206View diagnostics
#ifdef _DEBUG
void CEx010206View::AssertValid() const
{
CRichEditView::AssertValid();
}
void CEx010206View::Dump(CDumpContext& dc) const
{
CRichEditView::Dump(dc);
}
CEx010206Doc* CEx010206View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx010206Doc)));
return (CEx010206Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEx010206View message handlers
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?