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

📄 readme.wzd

📁 《Visual C++ MFC编程实例》配套代码,如果大家正在学习此教程
💻 WZD
字号:
/////////////////////////////////////////////////////////////////////
// Example files.
/////////////////////////////////////////////////////////////////////

FrstPage.cpp  -- sample property page classes
FrstPage.h
ScndPage.cpp
ScndPage.h

/////////////////////////////////////////////////////////////////////
// Modify the Mainframe Class.
/////////////////////////////////////////////////////////////////////

// 1) include "afxpriv.h" since we will be using the ON_MESSAGE_VOID macro

// 2) add a declaration for a message which will be sent by the property sheet
// when the user hits the "Apply" button
	protected:
	//{{AFX_MSG(CMainFrame)
	//}}AFX_MSG
	afx_msg void OnApply();
	DECLARE_MESSAGE_MAP()

// 3) add this handler to the message map
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
	//}}AFX_MSG_MAP
	ON_MESSAGE_VOID(WM_APPLY,OnApply)
END_MESSAGE_MAP()

// 4) use the Dialog Editor to create property pages and the ClassWizard
// to create classes for them (please refer to the book)

// 5) embed these property page classes in your Mainframe Class

// 6) add a menu command for "Preferences" 

// 7) use the ClassWizard to add a command handler for this command
void CMainFrame::OnOptionsPreferences() 
{

// 8) create the property sheet class
	CPropertySheet sheet(_T("Preferences"),this);

// 9) create property page class objects
	m_pFirstPage=new CFirstPage;
	m_pSecondPage=new CSecondPage;

// 10) add pages to sheet
	sheet.AddPage(m_pFirstPage);
	sheet.AddPage(m_pSecondPage);

// 11) initialize the values in the pages
	m_pFirstPage->m_bOption1 = m_bFirstOption1;
	m_pFirstPage->m_sOption2 = m_sFirstOption2;
	m_pSecondPage->m_nOption1 = m_nSecondOption1;
	m_pSecondPage->m_sOption2 = m_sSecondOption2;

// 12) create property sheet
	if (sheet.DoModal()==IDOK)
	{

// 13) if user presses OK, call OnApply()
		OnApply();
	}
	delete m_pFirstPage;
	delete m_pSecondPage;
}

// 14) this function is called by "preferences" command and is a handler
// for the message sent when the user presses the "Apply" button
void CMainFrame::OnApply()
{
	m_bFirstOption1 = m_pFirstPage->m_bOption1; 
	m_sFirstOption2 = m_pFirstPage->m_sOption2; 
	m_nSecondOption1 = m_pSecondPage->m_nOption1;
	m_sSecondOption2 = m_pSecondPage->m_sOption2;
}


/////////////////////////////////////////////////////////////////////
// From: Visual C++ MFC Programming by Example by John E. Swanke
// Copyright (C) 1998 jeswanke. All rights reserved.
/////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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