e0602view.cpp

来自「Visualc++6.0自学手册第6章」· C++ 代码 · 共 113 行

CPP
113
字号
// E0602View.cpp : implementation of the CE0602View class
//

#include "stdafx.h"
#include "E0602.h"

#include "E0602Doc.h"
#include "E0602View.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CE0602View

IMPLEMENT_DYNCREATE(CE0602View, CView)

BEGIN_MESSAGE_MAP(CE0602View, CView)
	//{{AFX_MSG_MAP(CE0602View)
	ON_WM_CHAR()
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CE0602View construction/destruction

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

}

CE0602View::~CE0602View()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CE0602View drawing

void CE0602View::OnDraw(CDC* pDC)
{
	CE0602Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CE0602View printing

BOOL CE0602View::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CE0602View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CE0602View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CE0602View diagnostics

#ifdef _DEBUG
void CE0602View::AssertValid() const
{
	CView::AssertValid();
}

void CE0602View::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CE0602View message handlers

void CE0602View::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	CString str;
	str.Format("键 %c 对应的ASCII码:\n\n    %x (十六进制)\n\n    %d (十进制)",nChar,nChar,nChar);
	MessageBox(str, "ASCII码");
	
	CView::OnChar(nChar, nRepCnt, nFlags);
}

⌨️ 快捷键说明

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