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

📄 testview.cpp

📁 《Visual C++编程技巧典型案例解析:基础与应用篇(下)(含1CD-ROM)——编程技巧典型案例集锦系列》源码
💻 CPP
字号:
// TestView.cpp : implementation of the CTestView class
//

#include "stdafx.h"
#include "Test.h"

#include "TestDoc.h"
#include "TestView.h"


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

/////////////////////////////////////////////////////////////////////////////
// CTestView

IMPLEMENT_DYNCREATE(CTestView, CView)

BEGIN_MESSAGE_MAP(CTestView, CView)
	//{{AFX_MSG_MAP(CTestView)
	ON_COMMAND(ID_DIALOG_INDOCVIEW, OnDialogInDocView)
	ON_COMMAND(ID_DIALOG_INDOCVIEW1, OnDialogInDocView1)
	ON_COMMAND(ID_DIALOG_INREGULARDLL, OnDialogInRegularDLL)
	ON_COMMAND(ID_DIALOG_INREGULARDLL1, OnOnDialogInRegularDLL1)
	ON_COMMAND(ID_DIALOG_EXTENSIONDLL, OnDialogExtensionDLL)
	ON_COMMAND(ID_DIALOG_EXTENSIONDLL1, OnOnDialogExtensionDLL1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTestView construction/destruction

CTestView::CTestView()
{
	m_pDlg = NULL;
	// TODO: add construction code here

}

CTestView::~CTestView()
{
	if(m_pDlg != NULL)
		delete m_pDlg;
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CTestView drawing

void CTestView::OnDraw(CDC* pDC)
{
	CTestDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	pDC->TextOut(30,100,"请测试菜单\"对话框\"下的每一项。当对话框打开后,在对话框中请点击\"测试\"");
	pDC->TextOut(0,120,"按钮,观察工具栏和菜单发生的变化; 并测试菜单加速键。");
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CTestView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CTestView message handlers
//模态对话框
void CTestView::OnDialogInDocView() 
{
	CTestDlg dlg;
	dlg.DoModal();
}
//非模态对话框
void CTestView::OnDialogInDocView1() 
{
	if(m_pDlg != NULL)
		delete m_pDlg;
	m_pDlg = new CTestDlg;
	m_pDlg->Create();
	m_pDlg->ShowWindow(TRUE);
	// TODO: Add your command handler code here	
}
//模态对话框在规则DLL中
void CTestView::OnDialogInRegularDLL() 
{
	CTestDlgInRDLL dlg;
	dlg.ModalDlgInRegularDLL();
	
}
//非模态对话框在规则DLL中
void CTestView::OnOnDialogInRegularDLL1() 
{
	m_dlgInRDLL.ModelessDlgInRegularDLL();
	
}
//模态对话框在扩展DLL中
void CTestView::OnDialogExtensionDLL() 
{
	CTestDlgInEDLL dlg;
	dlg.ModalDlgInExtensionDLL();	
}
//非模态对话框在扩展DLL中
void CTestView::OnOnDialogExtensionDLL1() 
{
	m_dlgInEDLL.ModelessDlgInExtensionDLL();
	
}

⌨️ 快捷键说明

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