⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialogview.cpp

📁 《Visual C++ 6.0实例教程》配套代码
💻 CPP
字号:
// DialogView.cpp : implementation of the CDialogView class
//

#include "stdafx.h"
#include "Dialog.h"

#include "DialogDoc.h"
#include "DialogView.h"
#include "DialogModal.h"
#include "DialogTab.h"
#include "DialogProgress.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDialogView

IMPLEMENT_DYNCREATE(CDialogView, CView)

BEGIN_MESSAGE_MAP(CDialogView, CView)
	//{{AFX_MSG_MAP(CDialogView)
	ON_COMMAND(ID_VIEW_MODALDIALOG, OnViewModaldialog)
	ON_COMMAND(ID_VIEW_MODALLESSDIALOG, OnViewModallessdialog)
	ON_COMMAND(ID_VIEW_PROGRESSDIALOG, OnViewProgressdialog)
	ON_COMMAND(ID_VIEW_TAB, OnViewTab)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CDialogView construction/destruction

CDialogView::CDialogView()
{
	// TODO: add construction code here
	m_pModallessDlg = NULL;//初始化指针
}

CDialogView::~CDialogView()
{
	if(m_pModallessDlg != NULL)
	{
		delete m_pModallessDlg;//释放空间
	}
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CDialogView drawing

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

/////////////////////////////////////////////////////////////////////////////
// CDialogView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CDialogView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CDialogView message handlers

void CDialogView::OnViewModaldialog() 
{
	// TODO: Add your command handler code here
   CDialogModal cDlg;
   cDlg.DoModal();
}

void CDialogView::OnViewModallessdialog() 
{
	// TODO: Add your command handler code here

	//如果指针指向NULL,说明对话框还没有创建,则动态创建
	if(m_pModallessDlg==NULL)
	{
		m_pModallessDlg=new CDialogModalless;
		m_pModallessDlg->Create(IDD_MODALLESS_DIALOG,this);
	}

	//显示非模态对话框
	m_pModallessDlg->ShowWindow(SW_SHOW);
}

void CDialogView::OnViewProgressdialog() 
{
	// TODO: Add your command handler code here
	CDialogProgress dlg;
	dlg.DoModal();
}

void CDialogView::OnViewTab() 
{
	// TODO: Add your command handler code here
	CDialogTab dlg;
	dlg.DoModal();
}

⌨️ 快捷键说明

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