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

📄 s7_4view.cpp

📁 四川大学教学的MFC的ppt 以及源代码
💻 CPP
字号:
// s7_4View.cpp : implementation of the CS7_4View class
//

#include "stdafx.h"
#include "s7_4.h"

#include "s7_4Doc.h"
#include "s7_4View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CS7_4View

IMPLEMENT_DYNCREATE(CS7_4View, CView)

BEGIN_MESSAGE_MAP(CS7_4View, CView)
	//{{AFX_MSG_MAP(CS7_4View)
	ON_WM_MOUSEMOVE()
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CS7_4View construction/destruction

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

}

CS7_4View::~CS7_4View()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CS7_4View drawing

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

/////////////////////////////////////////////////////////////////////////////
// CS7_4View printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CS7_4View diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CS7_4View message handlers

void CS7_4View::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	char		caBuf[80];		//定义字符数组
	CClientDC	oDC(this);		//将当前视图对象定义成设备实例
	sprintf(caBuf, "[%06d,%03d]", point.x*point.y, point.y);	//将鼠标坐标值复制到caBuf中
	oDC.TextOut(60, 80, caBuf, strlen(caBuf));	
	if (point.y==100)
	{
		sprintf(caBuf, "[%06dHEHE,%03d]", point.x*point.y, point.y);
	}//在(60, 80)处显示鼠标坐标值

	CView::OnMouseMove(nFlags, point);
}

⌨️ 快捷键说明

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