dialog_1view.cpp

来自「C++入门经典」· C++ 代码 · 共 113 行

CPP
113
字号
// dialog_1View.cpp : implementation of the CDialog_1View class
//

#include "stdafx.h"
#include "dialog_1.h"

#include "dialog_1Doc.h"
#include "dialog_1View.h"
#include "DialogModal.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDialog_1View

IMPLEMENT_DYNCREATE(CDialog_1View, CView)

BEGIN_MESSAGE_MAP(CDialog_1View, CView)
	//{{AFX_MSG_MAP(CDialog_1View)
	ON_COMMAND(ID_VIEW_MODALDIALOG, OnViewModaldialog)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CDialog_1View construction/destruction

CDialog_1View::CDialog_1View()
{
	// TODO: add construction code here

}

CDialog_1View::~CDialog_1View()
{
}

BOOL CDialog_1View::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CDialog_1View drawing

void CDialog_1View::OnDraw(CDC* pDC)
{
	CDialog_1Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CDialog_1View printing

BOOL CDialog_1View::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CDialog_1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CDialog_1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CDialog_1View diagnostics

#ifdef _DEBUG
void CDialog_1View::AssertValid() const
{
	CView::AssertValid();
}

void CDialog_1View::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CDialog_1Doc* CDialog_1View::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDialog_1Doc)));
	return (CDialog_1Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CDialog_1View message handlers
	

void CDialog_1View::OnViewModaldialog()
{
	//TODO:Add your command handler code here
	CDialogModal m_Dlg;		//创建对话框对象
	m_Dlg.DoModal();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?