提交 | 用户 | age
4b03ae 1 
Q 2 // MFCApplication3View.cpp: CMFCApplication3View 类的实现
3 //
4
5 #include "pch.h"
6 #include "framework.h"
7 // SHARED_HANDLERS 可以在实现预览、缩略图和搜索筛选器句柄的
8 // ATL 项目中进行定义,并允许与该项目共享文档代码。
9 #ifndef SHARED_HANDLERS
10 #include "MFCApplication3.h"
11 #endif
12
13 #include "MFCApplication3Doc.h"
14 #include "MFCApplication3View.h"
15
16 #ifdef _DEBUG
17 #define new DEBUG_NEW
18 #endif
19
20
21 // CMFCApplication3View
22
23 IMPLEMENT_DYNCREATE(CMFCApplication3View, CScrollView)
24
25 BEGIN_MESSAGE_MAP(CMFCApplication3View, CScrollView)
26     // 标准打印命令
27     ON_COMMAND(ID_FILE_PRINT, &CScrollView::OnFilePrint)
28     ON_COMMAND(ID_FILE_PRINT_DIRECT, &CScrollView::OnFilePrint)
29     ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CScrollView::OnFilePrintPreview)
30 END_MESSAGE_MAP()
31
32 // CMFCApplication3View 构造/析构
33
34 CMFCApplication3View::CMFCApplication3View() noexcept
35 {
36     // TODO: 在此处添加构造代码
37
38 }
39
40 CMFCApplication3View::~CMFCApplication3View()
41 {
42 }
43
44 BOOL CMFCApplication3View::PreCreateWindow(CREATESTRUCT& cs)
45 {
46     // TODO: 在此处通过修改
47     //  CREATESTRUCT cs 来修改窗口类或样式
48
49     return CScrollView::PreCreateWindow(cs);
50 }
51
52 // CMFCApplication3View 绘图
53
54 void CMFCApplication3View::OnDraw(CDC* /*pDC*/)
55 {
56     CMFCApplication3Doc* pDoc = GetDocument();
57     ASSERT_VALID(pDoc);
58     if (!pDoc)
59         return;
60
61     // TODO: 在此处为本机数据添加绘制代码
62 }
63
64 void CMFCApplication3View::OnInitialUpdate()
65 {
66     CScrollView::OnInitialUpdate();
67
68     CSize sizeTotal;
69     // TODO: 计算此视图的合计大小
70     sizeTotal.cx = sizeTotal.cy = 100;
71     SetScrollSizes(MM_TEXT, sizeTotal);
72 }
73
74
75 // CMFCApplication3View 打印
76
77 BOOL CMFCApplication3View::OnPreparePrinting(CPrintInfo* pInfo)
78 {
79     // 默认准备
80     return DoPreparePrinting(pInfo);
81 }
82
83 void CMFCApplication3View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
84 {
85     // TODO: 添加额外的打印前进行的初始化过程
86 }
87
88 void CMFCApplication3View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
89 {
90     // TODO: 添加打印后进行的清理过程
91 }
92
93
94 // CMFCApplication3View 诊断
95
96 #ifdef _DEBUG
97 void CMFCApplication3View::AssertValid() const
98 {
99     CScrollView::AssertValid();
100 }
101
102 void CMFCApplication3View::Dump(CDumpContext& dc) const
103 {
104     CScrollView::Dump(dc);
105 }
106
107 CMFCApplication3Doc* CMFCApplication3View::GetDocument() const // 非调试版本是内联的
108 {
109     ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMFCApplication3Doc)));
110     return (CMFCApplication3Doc*)m_pDocument;
111 }
112 #endif //_DEBUG
113
114
115 // CMFCApplication3View 消息处理程序