【VC开源代码栏目提醒】:网学会员在VC开源代码频道为大家收集整理了ex81View.cpp提供大家参考,希望对大家有所帮助!
// ex81View.cpp : Cex81View 类的实现
//
#include "stdafx.h"
#include "ex81.h"
#include "mainfrm.h"
#include "ex81Doc.h"
#include "ex81View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// Cex81View
IMPLEMENT_DYNCREATE(Cex81View, CView)
BEGIN_MESSAGE_MAP(Cex81View, CView)
// 标准打印命令
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
END_MESSAGE_MAP()
// Cex81View 构造/销毁
Cex81View::Cex81View()
{
// TODO: 在此处添加构造代码
}
Cex81View::~Cex81View()
{
}
BOOL Cex81View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或
// 样式
return CView::PreCreateWindow(cs);
}
// Cex81View 绘制
void Cex81View::OnDraw(CDC* pDC)
{
Cex81Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: 在此处为本机数据添加绘制代码
pDC->TextOut(0,0,"移动鼠标并按鼠标按钮,观看状态条!");
}
// Cex81View 打印
BOOL Cex81View::OnPreparePrinting(CPrintInfo* pInfo)
{
// 默认准备
return DoPreparePrinting(pInfo);
}
void Cex81View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: 打印前添加额外的初始化
}
void Cex81View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: 打印后添加清除过程
}
// Cex81View 诊断
#ifdef _DEBUG
void Cex81View::AssertValid() const
{
CView::AssertValid();
}
void Cex81View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
Cex81Doc* Cex81View::GetDocument() const // 非调试版本是内联的
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(Cex81Doc)));
return (Cex81Doc*)m_pDocument;
}
#endif //_DEBUG
// Cex81View 消息处理程序
void Cex81View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理
程序代码和/或调用默认值
CView::OnLButtonDown(nFlags, point);
}
void Cex81View::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
CString str;
CMainFrame* pFrame = (CMainFrame*) AfxGetApp()->m_pMainWnd;
CStatusBar* pStatus = &pFrame->m_wndStatusBar;
if (pStatus) {
str.Format("x = %d", point.x);
pStatus->SetPaneText(0, str);
str.Format("y = %d", point.y);
pStatus->SetPaneText(1, str);
}
CView::OnMouseMove(nFlags, point);
}