⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exam4_1view.cpp

📁 C++程序设计源代码例
💻 CPP
字号:
// Exam4_1View.cpp : implementation of the CExam4_1View class
//

#include "stdafx.h"
#include "Exam4_1.h"

#include "Exam4_1Doc.h"
#include "Exam4_1View.h"
#include "resource.h"

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

/////////////////////////////////////////////////////////////////////////////
// CExam4_1View

IMPLEMENT_DYNCREATE(CExam4_1View, CEditView)

BEGIN_MESSAGE_MAP(CExam4_1View, CEditView)
	ON_WM_CONTEXTMENU()
	//{{AFX_MSG_MAP(CExam4_1View)
	ON_COMMAND(ID_COLOR_FORECOLOR, OnColorForecolor)
	ON_COMMAND(ID_COLOR_BACKCOLOR, OnColorBackcolor)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CEditView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CEditView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CEditView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CExam4_1View construction/destruction

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

}

CExam4_1View::~CExam4_1View()
{
}

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

	BOOL bPreCreated = CEditView::PreCreateWindow(cs);
	cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL);	// Enable word-wrapping

	return bPreCreated;
}

/////////////////////////////////////////////////////////////////////////////
// CExam4_1View drawing

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

/////////////////////////////////////////////////////////////////////////////
// CExam4_1View printing

BOOL CExam4_1View::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default CEditView preparation
	return CEditView::OnPreparePrinting(pInfo);
}

void CExam4_1View::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
	// Default CEditView begin printing.
	CEditView::OnBeginPrinting(pDC, pInfo);
}

void CExam4_1View::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
{
	// Default CEditView end printing
	CEditView::OnEndPrinting(pDC, pInfo);
}

/////////////////////////////////////////////////////////////////////////////
// CExam4_1View diagnostics

#ifdef _DEBUG
void CExam4_1View::AssertValid() const
{
	CEditView::AssertValid();
}

void CExam4_1View::Dump(CDumpContext& dc) const
{
	CEditView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CExam4_1View message handlers

void CExam4_1View::OnContextMenu(CWnd*, CPoint point)
{
	// CG: This block was added by the Pop-up Menu component	{		if (point.x == -1 && point.y == -1){			//keystroke invocation			CRect rect;			GetClientRect(rect);			ClientToScreen(rect);			point = rect.TopLeft();			point.Offset(5, 5);		}		CMenu menu;		VERIFY(menu.LoadMenu(CG_IDR_POPUP_EXAM4_1_VIEW));		CMenu* pPopup = menu.GetSubMenu(0);		ASSERT(pPopup != NULL);		CWnd* pWndPopupOwner = this;		while (pWndPopupOwner->GetStyle() & WS_CHILD)			pWndPopupOwner = pWndPopupOwner->GetParent();		pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,			pWndPopupOwner);	}
}

void CExam4_1View::OnColorForecolor() 
{
	// TODO: Add your command handler code here
	AfxMessageBox("in OnColorForecolor");
	
}

void CExam4_1View::OnColorBackcolor() 
{
	// TODO: Add your command handler code here
	AfxMessageBox("in OnColorBackcolor");
	
}

⌨️ 快捷键说明

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