Loading...
Loading...
Compare original and translation side by side
Syncfusion.Tools.Windows.dllSyncfusion.Windows.Forms.ToolsSyncfusion.Tools.Windows.dllSyncfusion.Windows.Forms.Toolsusing System;
using System.Drawing;
using System.Windows.Forms;
using Syncfusion.Windows.Forms.Tools;
public partial class InstallationWizard : Form
{
private WizardControl wizardControl1;
private WizardControlPage welcomePage;
private WizardControlPage licensePage;
private WizardControlPage installPage;
private WizardControlPage finishPage;
public InstallationWizard()
{
InitializeComponent();
CreateWizard();
}
private void CreateWizard()
{
// Create wizard control
wizardControl1 = new WizardControl
{
Dock = DockStyle.Fill,
Style = Syncfusion.Windows.Forms.Tools.Wizard.Style.Metro
};
// Create pages
welcomePage = new WizardControlPage
{
Title = "Welcome",
Description = "Welcome to the Installation Wizard",
BackVisible = false // Hide Back on first page
};
licensePage = new WizardControlPage
{
Title = "License Agreement",
Description = "Please read and accept the license terms"
};
installPage = new WizardControlPage
{
Title = "Installing",
Description = "Please wait while files are being installed"
};
finishPage = new WizardControlPage
{
Title = "Completed",
Description = "Installation completed successfully",
NextVisible = false,
CancelVisible = false,
FinishVisible = true
};
// Add pages to wizard
wizardControl1.WizardPages = new WizardControlPage[]
{
welcomePage,
licensePage,
installPage,
finishPage
};
// Add wizard to form
this.Controls.Add(wizardControl1);
this.Text = "Setup Wizard";
this.Size = new Size(600, 450);
}
}Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports Syncfusion.Windows.Forms.Tools
Public Partial Class InstallationWizard
Inherits Form
Private wizardControl1 As WizardControl
Private welcomePage As WizardControlPage
Private licensePage As WizardControlPage
Private installPage As WizardControlPage
Private finishPage As WizardControlPage
Public Sub New()
InitializeComponent()
CreateWizard()
End Sub
Private Sub CreateWizard()
' Create wizard control
wizardControl1 = New WizardControl With {
.Dock = DockStyle.Fill,
.Style = Syncfusion.Windows.Forms.Tools.Wizard.Style.Metro
}
' Create pages
welcomePage = New WizardControlPage With {
.Title = "Welcome",
.Description = "Welcome to the Installation Wizard",
.BackVisible = False
}
licensePage = New WizardControlPage With {
.Title = "License Agreement",
.Description = "Please read and accept the license terms"
}
installPage = New WizardControlPage With {
.Title = "Installing",
.Description = "Please wait while files are being installed"
}
finishPage = New WizardControlPage With {
.Title = "Completed",
.Description = "Installation completed successfully",
.NextVisible = False,
.CancelVisible = False,
.FinishVisible = True
}
' Add pages to wizard
wizardControl1.WizardPages = New WizardControlPage() {
welcomePage,
licensePage,
installPage,
finishPage
}
' Add wizard to form
Me.Controls.Add(wizardControl1)
Me.Text = "Setup Wizard"
Me.Size = New Size(600, 450)
End Sub
End Classusing System;
using System.Drawing;
using System.Windows.Forms;
using Syncfusion.Windows.Forms.Tools;
public partial class InstallationWizard : Form
{
private WizardControl wizardControl1;
private WizardControlPage welcomePage;
private WizardControlPage licensePage;
private WizardControlPage installPage;
private WizardControlPage finishPage;
public InstallationWizard()
{
InitializeComponent();
CreateWizard();
}
private void CreateWizard()
{
// 创建向导控件
wizardControl1 = new WizardControl
{
Dock = DockStyle.Fill,
Style = Syncfusion.Windows.Forms.Tools.Wizard.Style.Metro
};
// 创建页面
welcomePage = new WizardControlPage
{
Title = "欢迎",
Description = "欢迎使用安装向导",
BackVisible = false // 首页面隐藏返回按钮
};
licensePage = new WizardControlPage
{
Title = "许可协议",
Description = "请阅读并接受许可条款"
};
installPage = new WizardControlPage
{
Title = "安装中",
Description = "请等待文件安装完成"
};
finishPage = new WizardControlPage
{
Title = "完成",
Description = "安装成功完成",
NextVisible = false,
CancelVisible = false,
FinishVisible = true
};
// 向向导添加页面
wizardControl1.WizardPages = new WizardControlPage[]
{
welcomePage,
licensePage,
installPage,
finishPage
};
// 向窗体添加向导
this.Controls.Add(wizardControl1);
this.Text = "安装向导";
this.Size = new Size(600, 450);
}
}Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports Syncfusion.Windows.Forms.Tools
Public Partial Class InstallationWizard
Inherits Form
Private wizardControl1 As WizardControl
Private welcomePage As WizardControlPage
Private licensePage As WizardControlPage
Private installPage As WizardControlPage
Private finishPage As WizardControlPage
Public Sub New()
InitializeComponent()
CreateWizard()
End Sub
Private Sub CreateWizard()
' 创建向导控件
wizardControl1 = New WizardControl With {
.Dock = DockStyle.Fill,
.Style = Syncfusion.Windows.Forms.Tools.Wizard.Style.Metro
}
' 创建页面
welcomePage = New WizardControlPage With {
.Title = "欢迎",
.Description = "欢迎使用安装向导",
.BackVisible = False
}
licensePage = New WizardControlPage With {
.Title = "许可协议",
.Description = "请阅读并接受许可条款"
}
installPage = New WizardControlPage With {
.Title = "安装中",
.Description = "请等待文件安装完成"
}
finishPage = New WizardControlPage With {
.Title = "完成",
.Description = "安装成功完成",
.NextVisible = False,
.CancelVisible = False,
.FinishVisible = True
}
' 向向导添加页面
wizardControl1.WizardPages = New WizardControlPage() {
welcomePage,
licensePage,
installPage,
finishPage
}
' 向窗体添加向导
Me.Controls.Add(wizardControl1)
Me.Text = "安装向导"
Me.Size = New Size(600, 450)
End Sub
End Classpublic partial class RegistrationWizard : Form
{
private WizardControlPage personalInfoPage;
private TextBox txtName;
private TextBox txtEmail;
private void SetupWizard()
{
personalInfoPage = new WizardControlPage
{
Title = "Personal Information",
Description = "Please enter your details"
};
// Add controls to page
txtName = new TextBox { Location = new Point(20, 20), Width = 300 };
txtEmail = new TextBox { Location = new Point(20, 60), Width = 300 };
personalInfoPage.Controls.Add(new Label
{
Text = "Name:",
Location = new Point(20, 0)
});
personalInfoPage.Controls.Add(txtName);
personalInfoPage.Controls.Add(new Label
{
Text = "Email:",
Location = new Point(20, 40)
});
personalInfoPage.Controls.Add(txtEmail);
// Subscribe to validation event
personalInfoPage.ValidatePage += PersonalInfoPage_ValidatePage;
}
private void PersonalInfoPage_ValidatePage(object sender,
System.ComponentModel.CancelEventArgs e)
{
// Validate name
if (string.IsNullOrWhiteSpace(txtName.Text))
{
MessageBox.Show("Please enter your name.", "Validation Error",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
e.Cancel = true;
txtName.Focus();
return;
}
// Validate email
if (string.IsNullOrWhiteSpace(txtEmail.Text) ||
!txtEmail.Text.Contains("@"))
{
MessageBox.Show("Please enter a valid email address.",
"Validation Error",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
e.Cancel = true;
txtEmail.Focus();
return;
}
}
}public partial class RegistrationWizard : Form
{
private WizardControlPage personalInfoPage;
private TextBox txtName;
private TextBox txtEmail;
private void SetupWizard()
{
personalInfoPage = new WizardControlPage
{
Title = "个人信息",
Description = "请输入你的详细信息"
};
// 向页面添加控件
txtName = new TextBox { Location = new Point(20, 20), Width = 300 };
txtEmail = new TextBox { Location = new Point(20, 60), Width = 300 };
personalInfoPage.Controls.Add(new Label
{
Text = "姓名:",
Location = new Point(20, 0)
});
personalInfoPage.Controls.Add(txtName);
personalInfoPage.Controls.Add(new Label
{
Text = "邮箱:",
Location = new Point(20, 40)
});
personalInfoPage.Controls.Add(txtEmail);
// 订阅验证事件
personalInfoPage.ValidatePage += PersonalInfoPage_ValidatePage;
}
private void PersonalInfoPage_ValidatePage(object sender,
System.ComponentModel.CancelEventArgs e)
{
// 验证姓名
if (string.IsNullOrWhiteSpace(txtName.Text))
{
MessageBox.Show("请输入你的姓名。", "验证错误",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
e.Cancel = true;
txtName.Focus();
return;
}
// 验证邮箱
if (string.IsNullOrWhiteSpace(txtEmail.Text) ||
!txtEmail.Text.Contains("@"))
{
MessageBox.Show("请输入有效的邮箱地址。",
"验证错误",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
e.Cancel = true;
txtEmail.Focus();
return;
}
}
}public partial class ConfigurationWizard : Form
{
private WizardControlPage typePage;
private WizardControlPage basicSettingsPage;
private WizardControlPage advancedSettingsPage;
private RadioButton rbBasic;
private RadioButton rbAdvanced;
private void SetupDynamicWizard()
{
typePage = new WizardControlPage
{
Title = "Configuration Type",
Description = "Choose your configuration level"
};
rbBasic = new RadioButton
{
Text = "Basic Configuration",
Location = new Point(20, 20),
Checked = true
};
rbAdvanced = new RadioButton
{
Text = "Advanced Configuration",
Location = new Point(20, 50)
};
typePage.Controls.Add(rbBasic);
typePage.Controls.Add(rbAdvanced);
basicSettingsPage = new WizardControlPage
{
Title = "Basic Settings",
Description = "Configure basic options"
};
advancedSettingsPage = new WizardControlPage
{
Title = "Advanced Settings",
Description = "Configure advanced options"
};
// Set dynamic page sequence
typePage.NextClick += TypePage_NextClick;
}
private void TypePage_NextClick(object sender, EventArgs e)
{
// Dynamically set next page based on selection
if (rbBasic.Checked)
{
typePage.NextPage = basicSettingsPage;
}
else
{
typePage.NextPage = advancedSettingsPage;
}
}
}public partial class ConfigurationWizard : Form
{
private WizardControlPage typePage;
private WizardControlPage basicSettingsPage;
private WizardControlPage advancedSettingsPage;
private RadioButton rbBasic;
private RadioButton rbAdvanced;
private void SetupDynamicWizard()
{
typePage = new WizardControlPage
{
Title = "配置类型",
Description = "选择你的配置级别"
};
rbBasic = new RadioButton
{
Text = "基础配置",
Location = new Point(20, 20),
Checked = true
};
rbAdvanced = new RadioButton
{
Text = "高级配置",
Location = new Point(20, 50)
};
typePage.Controls.Add(rbBasic);
typePage.Controls.Add(rbAdvanced);
basicSettingsPage = new WizardControlPage
{
Title = "基础设置",
Description = "配置基础选项"
};
advancedSettingsPage = new WizardControlPage
{
Title = "高级设置",
Description = "配置高级选项"
};
// 设置动态页面流程
typePage.NextClick += TypePage_NextClick;
}
private void TypePage_NextClick(object sender, EventArgs e)
{
// 根据选择动态设置下一页
if (rbBasic.Checked)
{
typePage.NextPage = basicSettingsPage;
}
else
{
typePage.NextPage = advancedSettingsPage;
}
}
}public partial class DataImportWizard : Form
{
private Label lblProgress;
private void SetupProgressWizard()
{
// Create progress label in banner
lblProgress = new Label
{
Text = "Step 1 of 4",
Location = new Point(400, 10),
AutoSize = true,
Font = new Font("Arial", 9, FontStyle.Bold)
};
// Add to wizard's banner panel (assuming gradientPanel1 is banner)
wizardControl1.BannerPanel.Controls.Add(lblProgress);
// Subscribe to page changes
wizardControl1.BeforePageSelect += WizardControl1_BeforePageSelect;
}
private void WizardControl1_BeforePageSelect(object sender, EventArgs e)
{
// Update progress based on current page
int currentIndex = wizardControl1.WizardPages.IndexOf(
wizardControl1.SelectedWizardPage);
int totalPages = wizardControl1.WizardPages.Count;
lblProgress.Text = $"Step {currentIndex + 1} of {totalPages}";
}
}public partial class DataImportWizard : Form
{
private Label lblProgress;
private void SetupProgressWizard()
{
// 在横幅中创建进度标签
lblProgress = new Label
{
Text = "第1步,共4步",
Location = new Point(400, 10),
AutoSize = true,
Font = new Font("Arial", 9, FontStyle.Bold)
};
// 添加到向导的横幅面板(假设gradientPanel1是横幅)
wizardControl1.BannerPanel.Controls.Add(lblProgress);
// 订阅页面切换事件
wizardControl1.BeforePageSelect += WizardControl1_BeforePageSelect;
}
private void WizardControl1_BeforePageSelect(object sender, EventArgs e)
{
// 根据当前页面更新进度
int currentIndex = wizardControl1.WizardPages.IndexOf(
wizardControl1.SelectedWizardPage);
int totalPages = wizardControl1.WizardPages.Count;
lblProgress.Text = $"第{currentIndex + 1}步,共{totalPages}步";
}
}| Property | Type | Description |
|---|---|---|
| | Collection of wizard pages |
| | Currently displayed page |
| | Panel containing banner controls |
| | Picture box for banner image |
| | Label displaying page title |
| | Label displaying page description |
| | Back navigation button |
| | Next navigation button |
| | Cancel button |
| | Finish button |
| | Help button |
| | Visual theme (Default, Metro, Office) |
| | Whether Back button triggers validation |
| | Automatically layout banner controls |
| | Automatically layout title label |
| | Automatically layout description label |
| 属性 | 类型 | 描述 |
|---|---|---|
| | 向导页面集合 |
| | 当前展示的页面 |
| | 包含横幅控件的面板 |
| | 用于展示横幅图片的图片框 |
| | 展示页面标题的标签 |
| | 展示页面描述的标签 |
| | 返回导航按钮 |
| | 下一步导航按钮 |
| | 取消按钮 |
| | 完成按钮 |
| | 帮助按钮 |
| | 视觉主题(Default、Metro、Office) |
| | 返回按钮是否触发验证 |
| | 是否自动布局横幅控件 |
| | 是否自动布局标题标签 |
| | 是否自动布局描述标签 |
| Property | Type | Description |
|---|---|---|
| | Page title text |
| | Page description text |
| | Back button visibility |
| | Next button visibility |
| | Cancel button visibility |
| | Finish button visibility |
| | Help button visibility |
| | Back button enabled state |
| | Next button enabled state |
| | Cancel button enabled state |
| | Finish button enabled state |
| | Help button enabled state |
| | Hide banner for full-page content |
| | Custom next page override |
| | Custom previous page override |
| | Position cancel over finish button |
| | Unique identifier for page |
| 属性 | 类型 | 描述 |
|---|---|---|
| | 页面标题文本 |
| | 页面描述文本 |
| | 返回按钮可见性 |
| | 下一步按钮可见性 |
| | 取消按钮可见性 |
| | 完成按钮可见性 |
| | 帮助按钮可见性 |
| | 返回按钮启用状态 |
| | 下一步按钮启用状态 |
| | 取消按钮启用状态 |
| | 完成按钮启用状态 |
| | 帮助按钮启用状态 |
| | 隐藏横幅以展示全页面内容 |
| | 自定义下一页跳转覆盖 |
| | 自定义上一页跳转覆盖 |
| | 将取消按钮放在完成按钮上方 |
| | 页面唯一标识符 |
Syncfusion.Tools.Windows.dllSyncfusion.Windows.Forms.ToolsSyncfusion.Tools.Windows.dllSyncfusion.Windows.Forms.Tools