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