Create and display the General Property Page dialog box
This section describes the creation and display of the General Property Page dialog box.
In fact, the process of creating and displaying the General Property Page dialog box is very similar to the wizard dialog box. Chicken Peck Rice Make a few changes to the wizard dialog box in the previous section, making it a General Property Page dialog box.
General Property Page dialog box creation steps:
1. Create a Property Page Dialog resource
The property Page dialog resource is created in the same way as the wizard dialog box, and the dialog resource in the previous session does not need to be modified.
2. Create a property page class
The property page class's Creation and the wizard dialog box's property page class are basically the same, except that the "next" and "Finish" buttons are not required in the General Property Page dialog, so overloaded functions such as onsetactive and onwizardfinish of the property page class in the previous lecture can be removed. That is, the onsetactive function in the Csummandpage class, the OnSetActive function in the Caddpage class, and the Onwizardfinish function can be deleted or commented out. No modifications are required for other parts.
3. Create a property sheet class
The process of creating a property sheet class is the same as the wizard dialog box property sheet class, so the Caddsheet class in the previous lecture does not need to be modified.
4. Display the General Property Page dialog box
The display of the Previous wizard dialog box is implemented in the Onbnclickedinstructbutton function, where the statement is sheet. SetWizardMode (); Is intended to set the property sheet as a wizard dialog mode, so you do not need to call the SetWizardMode member function when you display the Generic Property Page dialog box. In addition, we can set the title of the Property Page dialog box to "Usage description", passing this string as a parameter to the constructor when constructing the property sheet object. The Onbnclickedinstructbutton function is modified as follows:
C + + code
- void Cadditiondlg::onbnclickedinstructbutton ()
- {
- //Todo:add your control notification handler code here
- //Create attribute Table object
- Caddsheet sheet (_t ("Instructions for use"));
- //Open Modal General Property Page dialog box
- Sheet. DoModal ();
- }
So when the General Property Page dialog box is created and displayed, let's run the next program and click the "Use Instructions" button on the results dialog to see how it works:
In summary, the differences between the creation and display of the General Property Page dialog box and the wizard dialog box include whether overloaded functions such as onsetactive and onwizardfinish are required, and whether the SetWizardMode function that calls the property sheet class needs to be set to the wizard dialog mode.
Is it easy to create and display a General Property Page dialog box? Here, the Property Pages dialog box is finished.
VS2010/MFC dialog box: Create and display the General Property Page dialog box