【VC开源代码栏目提醒】:网学会员鉴于大家对VC开源代码十分关注,论文会员在此为大家搜集整理了“ex3View.cpp”一文,供大家参考学习
// ex3View.cpp : Cex3View 类的实现
//
#include "stdafx.h"
#include "ex3.h"
#include "ex3Doc.h"
#include "ex3View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// Cex3View
IMPLEMENT_DYNCREATE(Cex3View, CView)
BEGIN_MESSAGE_MAP(Cex3View, 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_PAINT()
END_MESSAGE_MAP()
// Cex3View 构造/销毁
Cex3View::Cex3View()
{
// TODO: 在此处添加构造代码
}
Cex3View::~Cex3View()
{
}
BOOL Cex3View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或
// 样式
return CView::PreCreateWindow(cs);
}
// Cex3View 绘制
void Cex3View::OnDraw(CDC* pDC)
{
Cex3Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: 在此处为本机数据添加绘制代码
pDC->TextOut (50,50,"欢迎您使用VC++.
NET!");
}
// Cex3View 打印
BOOL Cex3View::OnPreparePrinting(CPrintInfo* pInfo)
{
// 默认准备
return DoPreparePrinting(pInfo);
}
void Cex3View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: 打印前添加额外的初始化
}
void Cex3View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: 打印后添加清除过程
}
// Cex3View 诊断
#ifdef _DEBUG
void Cex3View::AssertValid() const
{
CView::AssertValid();
}
void Cex3View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
Cex3Doc* Cex3View::GetDocument() const // 非调试版本是内联的
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(Cex3Doc)));
return (Cex3Doc*)m_pDocument;
}
#endif //_DEBUG
// Cex3View 消息处理程序
void Cex3View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理
程序代码和/或调用默认值
CView::OnLButtonDown(nFlags, point);
}
void Cex3View::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: 在此添加消息处理程序代码
// 不为绘图消息调用 CView::OnPaint()
OnDraw(&dc);
}