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

📄 mymessageview.cpp

📁 这个是我们学校用的VC++教案
💻 CPP
字号:
// MyMessageView.cpp : implementation of the CMyMessageView class
//

#include "stdafx.h"
#include "MyMessage.h"

#include "MyMessageDoc.h"
#include "MyMessageView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyMessageView

IMPLEMENT_DYNCREATE(CMyMessageView, CView)

BEGIN_MESSAGE_MAP(CMyMessageView, CView)
	//{{AFX_MSG_MAP(CMyMessageView)
	ON_WM_LBUTTONDOWN()
	ON_WM_RBUTTONDOWN()
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CMyMessageView construction/destruction

CMyMessageView::CMyMessageView()
{
	// TODO: add construction code here
	m_nLeft=0;
	m_nRight=0;
}

CMyMessageView::~CMyMessageView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMyMessageView drawing

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

/////////////////////////////////////////////////////////////////////////////
// CMyMessageView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMyMessageView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMyMessageView message handlers

void CMyMessageView::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	m_nLeft++;  // 左击鼠标次数加一
	CString strOutput; // 产生用于输出的格式化字符串
	strOutput.Format("The times of left button down: %d", m_nLeft);
	MessageBox(strOutput); // 弹出提示信息框
	CView::OnLButtonDown(nFlags, point);
}

void CMyMessageView::OnRButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	m_nRight++;  // 右击鼠标次数加一
	CString strOutput; // 产生用于输出的格式化字符串
	strOutput.Format("The times of right button down: %d", m_nRight);
	MessageBox(strOutput); // 弹出提示信息框	
	CView::OnRButtonDown(nFlags, point);
}

⌨️ 快捷键说明

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