The first step:
To create multiple property pages, you can add a dialog resource, and then modify the properties of the dialog resource, in VS2010, modify the following 3: Style set to Child;border set to Thin;system menu set to Fasul;
The title bar is True (the default is true); Modify caption: The name of the tab for this property page;
Step Two:
To add a class for the above property page, select the parent class as CPropertyPage; Add a class by right-clicking the dialog box.
(If there is no CPropertyPage class in the parent class, add it from the Class Wizard, you need to select the appropriate dialog ID when adding this method, and several property pages to add several classes)
Suppose there are two tabs, that is, the property page, the class name is Cpage1,cpage2;
Step Three:
Using the Class Wizard to add a new MFC class, the parent class is the CPropertySheet class (the property sheet Class), assuming the class name is Csheet (it does not correspond to any dialog box by default);
Fourth Step: (Link the property page and the property sheet table)
Create a property Page object in the Csheet (property sheet Class) class:
CPage1 M_page1;
CPage2 M_page2;
Because the Cpage1,cpage2 two classes are used, the header file of the property page needs to be included in the Csheet header file:
#include "CPage1"
#include "CPage2"
Fifth Step:
(The fourth step is to simply declare the property page in the form or just add two objects to the property page in the form class, and also use the member function of the property sheet CPropertySheet addpage to display the property page in the property sheet.)
You can understand this: the fourth step is to indicate that the property sheet has these two property pages, and the fifth step is to bring this property page to use.
In the Csheet constructor (it has two constructors, whichever one is used, it is recommended to use the first variable for the LPCTSTR), add the following code:
AddPage (&M_PAGE1);
AddPage (&m_page2);
This will completely transfer the property page to the form.
Sixth step:
Add an execution function to the button for the main dialog box:
Csheet Prsheet (_t ("expected form total name"))//prsheet is an instance object of Csheet, remember that class can not be used directly, you have to instantiate the line; _t () is 2010 coding style required;
"Expected form total name" is the parameter of the constructor
Prsheet. DoModal ();//Displays the instantiated property sheet in modal window;
VS2010, MFC dialog box program, click a button to pop up a property page interface with multiple tabs (that is, the property sheet)