Chapter 12: Dialog-Based Windows Visual C++ and MFC Fundamentals
Practical Learning: Creating a Floating Property Sheet
- Display the Add Resource dialog box. Expand the Dialog node and double-click
IDD_PROPPAGE_SMALL. Delete its TODO line. Change its ID to
IDD_SMALL_PAGE and its Caption to Small. Add a class for the dialog box.
Name it CSmallPge and base it on CPropertyPage - In the same way, add another IDD_PROPPAGE_SMALL dialog box. Delete its
TODO line. Change its ID to IDD_MEDIUM_PAGE and its Caption to Medium.
Add a class for the dialog box. Name it CMediumPge and base it on
CPropertyPage - Add a class named CFloatingSheet and based on CPropertySheet
- Change the header file as follows:
#pragma once
#include "SmallPage.h"
#include "MediumPage.h"
// CFloatingSheet
class CFloatingSheet : public CPropertySheet
{
DECLARE_DYNAMIC(CFloatingSheet)
public:
// CFloatingSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage
= 0);
CFloatingSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT
iSelectPage = 0);
virtual ~CFloatingSheet();
protected:
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnClose();
CSmallPage pgSmall;
CMediumPage pgMedium;
};
- In its source file, add each page as follows:
// FloatingSheet.cpp : implementation file
//
#include "stdafx.h"
#include "Floating.h"
#include "FloatingSheet.h"
// CFloatingSheet
IMPLEMENT_DYNAMIC(CFloatingSheet, CPropertySheet)
/*
CFloatingSheet::CFloatingSheet(UINT nIDCaption, CWnd* pParentWnd, UINT
iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
}