// MTerm1View.cpp: CMTerm1View 类的实现 // #include "pch.h" #include "framework.h" // SHARED_HANDLERS 可以在实现预览、缩略图和搜索筛选器句柄的 // ATL 项目中进行定义,并允许与该项目共享文档代码。 #ifndef SHARED_HANDLERS #include "MTerm1.h" #endif #include "MTerm1Doc.h" #include "MTerm1View.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CMTerm1View IMPLEMENT_DYNCREATE(CMTerm1View, CView) BEGIN_MESSAGE_MAP(CMTerm1View, CView) // 标准打印命令 ON_COMMAND(ID_FILE_PRINT, &CView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_DIRECT, &CView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CMTerm1View::OnFilePrintPreview) ON_WM_CONTEXTMENU() ON_WM_RBUTTONUP() END_MESSAGE_MAP() // CMTerm1View 构造/析构 CMTerm1View::CMTerm1View() noexcept { // TODO: 在此处添加构造代码 } CMTerm1View::~CMTerm1View() { } BOOL CMTerm1View::PreCreateWindow(CREATESTRUCT& cs) { // TODO: 在此处通过修改 // CREATESTRUCT cs 来修改窗口类或样式 return CView::PreCreateWindow(cs); } // CMTerm1View 绘图 void CMTerm1View::OnDraw(CDC* /*pDC*/) { CMTerm1Doc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; // TODO: 在此处为本机数据添加绘制代码 } // CMTerm1View 打印 void CMTerm1View::OnFilePrintPreview() { #ifndef SHARED_HANDLERS AFXPrintPreview(this); #endif } BOOL CMTerm1View::OnPreparePrinting(CPrintInfo* pInfo) { // 默认准备 return DoPreparePrinting(pInfo); } void CMTerm1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: 添加额外的打印前进行的初始化过程 } void CMTerm1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: 添加打印后进行的清理过程 } void CMTerm1View::OnRButtonUp(UINT /* nFlags */, CPoint point) { ClientToScreen(&point); OnContextMenu(this, point); } void CMTerm1View::OnContextMenu(CWnd* /* pWnd */, CPoint point) { #ifndef SHARED_HANDLERS theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE); #endif } // CMTerm1View 诊断 #ifdef _DEBUG void CMTerm1View::AssertValid() const { CView::AssertValid(); } void CMTerm1View::Dump(CDumpContext& dc) const { CView::Dump(dc); } CMTerm1Doc* CMTerm1View::GetDocument() const // 非调试版本是内联的 { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMTerm1Doc))); return (CMTerm1Doc*)m_pDocument; } #endif //_DEBUG // CMTerm1View 消息处理程序