📄 mfcdemoview.cpp
字号:
// MFCDemoView.cpp : implementation of the CMFCDemoView class
//
#include "stdafx.h"
#include "MFCDemo.h"
#include "MFCDemoDoc.h"
#include "MFCDemoView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMFCDemoView
IMPLEMENT_DYNCREATE(CMFCDemoView, CView)
BEGIN_MESSAGE_MAP(CMFCDemoView, CView)
//{{AFX_MSG_MAP(CMFCDemoView)
ON_WM_RBUTTONDOWN()
ON_COMMAND(IDR_SAMPLETYPE, OnSampletype)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMFCDemoView construction/destruction
CMFCDemoView::CMFCDemoView()
{
// TODO: add construction code here
m_pModallessDlg = NULL;
}
CMFCDemoView::~CMFCDemoView()
{
}
BOOL CMFCDemoView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMFCDemoView drawing
void CMFCDemoView::OnDraw(CDC* pDC)
{
CMFCDemoDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CMFCDemoView printing
BOOL CMFCDemoView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CMFCDemoView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CMFCDemoView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CMFCDemoView diagnostics
#ifdef _DEBUG
void CMFCDemoView::AssertValid() const
{
CView::AssertValid();
}
void CMFCDemoView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CMFCDemoDoc* CMFCDemoView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMFCDemoDoc)));
return (CMFCDemoDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMFCDemoView message handlers
void CMFCDemoView::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CMenu dMenu;
if(!dMenu.LoadMenu(IDR_MENU1))
AfxThrowResourceException();
CMenu *pPopupMenu = dMenu.GetSubMenu(0);
ASSERT(pPopupMenu != NULL);
ClientToScreen(&point);
pPopupMenu->TrackPopupMenu(TPM_CENTERALIGN|TPM_RIGHTBUTTON, point.x, point.y, AfxGetMainWnd());
CView::OnRButtonDown(nFlags, point);
}
void CMFCDemoView::OnSampletype()
{
// TODO: Add your command handler code here
// 非模态对话框
if(m_pModallessDlg == NULL)
{
m_pModallessDlg = new CDialogModalless();
m_pModallessDlg->Create(IDD_MODALLESS);
}
m_pModallessDlg->ShowWindow(TRUE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -