WizardPage Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides the base class for wizard pages that are shown in a WizardForm object.
public ref class WizardPage abstract : System::Windows::Forms::UserControl
public abstract class WizardPage : System.Windows.Forms.UserControl
type WizardPage = class
inherit UserControl
Public MustInherit Class WizardPage
Inherits UserControl
- Inheritance
-
WizardPage
Examples
The following example implements several of the methods and properties of the WizardPage class. This example builds one of three wizard pages that are contained on the WizardForm object. The first wizard page displays user name and password text boxes that have a Submit button to enable the user to submit the credentials for validation before moving to the next wizard page.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Microsoft.Web.Management.Client;
using Microsoft.Web.Management.Client.Win32;
namespace ExtensibilityDemo
{
public partial class DemoModuleWizardLoginPage : WizardPage
{
bool _canNavigateNext = false;
public DemoModuleWizardLoginPage()
{
InitializeComponent();
}
// Activate is called upon initial load.
protected override void Activate()
{
Description = this.Name;
}
// This is the login page. You can navigate to the next page,
// after the user is validted. Set initially to false.
protected override bool CanNavigateNext
{
get
{
return _canNavigateNext;
}
}
// Customize the CanNavigateNext property. This property
// is set to false until the user is validated.
private void button1_Click(object sender, EventArgs e)
{
// Perform user validation checks. If this is a valid
// user move to the next page. If the user is not a valid
// user, exit the application.
// User validation.
string text = "Did the user pass validation?";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
MessageBoxIcon icon = MessageBoxIcon.Information;
MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button2;
DialogResult result = ShowMessage(text, buttons, icon, defaultButton);
if (result == DialogResult.No)
{
Application.Exit();
}
else
{
_canNavigateNext = true;
this.UpdateWizard();
ShowHelp();
}
}
// Customize the CanShowHelp method.
public new bool CanShowHelp
{
get
{
return true;
}
}
// Customize the ShowHelp method.
public new void ShowHelp()
{
// Check to determine if the CanShowHelp will
// allow help to be shown.
if (CanShowHelp)
{
// Show the help file.
Help.ShowHelp(this, "D:/minint/Microsoft.NET/framework/1033/admin.chm");
// Alternatively, use the folllowing to navigate to Tech Net.
//Help.ShowHelp(null, "http://www.technet.com");
}
}
protected new DialogResult ShowMessage(string text,
MessageBoxButtons buttons,
MessageBoxIcon icon,
MessageBoxDefaultButton defaultButton)
{
return base.ShowMessage(text + " Yes or No.", buttons, icon, defaultButton);
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Microsoft.Web.Management.Client;
using Microsoft.Web.Management.Client.Win32;
namespace ExtensibilityDemo
{
public partial class DemoModuleWizardModificationPage : WizardPage
{
private string _caption;
private bool _rightToLeftLayout=false;
private string _description;
public DemoModuleWizardModificationPage()
{
InitializeComponent();
}
protected override void Activate()
{
_description = this.Name;
_caption = "Original Caption";
this.button4.Text = "Change R to L Layout : currently " + RightToLeft.ToString();
}
// This is the modificationpage page. You can navigate to the previous page.
protected override bool CanNavigatePrevious
{
get
{
return true;
}
}
// Customize the Caption Property.
public new string Caption
{
get
{
return _caption;
}
set
{
_caption = value;
}
}
// Customize the Description Property.
public new string Description
{
get
{
return _description;
}
set
{
_description = value;
}
}
// The Caption button is clicked.
private void button2_Click(object sender, EventArgs e)
{
Caption = "Caption Modified";
}
// The Description button is clicked.
private void button3_Click(object sender, EventArgs e)
{
Description = Caption.ToString();
this.Wizard.TaskCaption = Description;
}
// Customize the RightToLeftLayout property.
public new bool RightToLeftLayout
{
get
{
return _rightToLeftLayout;
}
set
{
_rightToLeftLayout = value;
}
}
// The Right to Left button is clicked.
private void button4_Click(object sender, EventArgs e)
{
if(RightToLeftLayout)
{
RightToLeft = RightToLeft.No;
}
else
{
RightToLeft = RightToLeft.Yes;
}
RightToLeftLayout = !RightToLeftLayout;
}
// The RightToLeft method was called.
protected override void OnRightToLeftChanged(EventArgs e)
{
this.button4.Text = "Change R to L Layout : currently " + RightToLeft.ToString();
base.OnRightToLeftChanged(e);
}
}
}
Remarks
Because this class is abstract, you cannot create an instance of it directly.
You can derive a page from the WizardPage class and add controls to provide specific functionality (for example, you can add text boxes for user credentials in a logon wizard page). The derived wizard pages are displayed in a WizardForm object. You can put controls such as ManagementGroupBox, ManagementPanel, and ManagementTabPage objects in the wizard page.
Constructors
WizardPage() |
Initializes a new instance of the WizardPage class. |
Properties
CanNavigateNext |
Gets a value indicating whether the user can move to the next wizard page. |
CanNavigatePrevious |
When overridden in a derived class, gets a value indicating whether the user can move to the previous wizard page. |
CanShowHelp |
When overridden in a derived class, gets a value indicating whether the ShowHelp() method is supported. |
Caption |
Gets or sets the caption of a form, wizard page, or other object. |
CreateParams |
Gets the required creation parameters when the wizard page is created. |
Description |
Gets or sets the description of a form, wizard page, or other object. |
NextPage |
When overridden in a derived class, gets the next page of the wizard. |
Pages |
Gets the IList interface that contains the collection of pages in the wizard. |
PreviousPage |
When overridden in a derived class, gets the previous page of the wizard. |
RightToLeftLayout |
Gets or sets a value indicating whether right-to-left mirror placement is enabled. |
ServiceProvider |
Gets service provider for the wizard form that contains this page. |
Wizard |
Gets wizard form that contains this wizard page. |
WizardData |
Gets the information for the wizard. |
Methods
Activate() |
When overridden in a derived class, indicates that the form has been loaded for the first time |
GetService(Type) |
Gets the service object that is associated with the specified type. |
OnNext() |
When overridden in a derived class, provides a mechanism to move to the next page of the wizard. |
OnPrevious() |
When overridden in a derived class, provides a mechanism to move to the previous page in the wizard. |
OnRightToLeftChanged(EventArgs) |
Provides a mechanism to perform an action when the RightToLeftLayout property changes. |
ShowError(Exception, String, Boolean) |
Displays the specified exception and information about the exception. |
ShowHelp() |
When overridden in a derived class, provides a mechanism to display the wizard Help file. |
ShowMessage(String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton) |
Displays a message box that uses the specified text, button set, symbol, and default button. |
ShowMessage(String) |
Displays a message box that uses the specified text. |
UpdateWizard() |
Provides a mechanism to update the wizard display. |