C#设计的一个向导程序(Wizard)框架 --VS2008版(三)
MailConfigureStep4.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
![]()
namespace UserControl
{
public partial class MailConfigureStep4 : MailControl.MailInfoBase
{
public MailConfigureStep4()
{
InitializeComponent();
}
protected override void UpdataInfo()
{
this.controller.info.UsrName = UsrName.Text;
this.controller.info.Password = Password.Text;
this.controller.info.SPA = SPA.Checked;
}
}
}
MailConfigureStep4.designer.cs
namespace UserControl
{
partial class MailConfigureStep4
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
![]()
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
![]()
Windows 窗体设计器生成的代码
![]()
private System.Windows.Forms.Button TestConfigure;
public System.Windows.Forms.CheckBox SPA;
private System.Windows.Forms.Label label5;
public System.Windows.Forms.TextBox Password;
public System.Windows.Forms.TextBox UsrName;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
}
}
添加完如上所述的4个子窗体后,
在该项目的Form1中添加一个按钮,设置点击该按钮时的事件如下:
private void 邮箱配置ToolStripMenuItem2_Click(object sender, EventArgs e)
{
MailConfigureStep1 stp1 = new MailConfigureStep1();
MailConfigureStep2 stp2 = new MailConfigureStep2();
MailConfigureStep3 stp3 = new MailConfigureStep3();
MailConfigureStep4 stp4 = new MailConfigureStep4();
ArrayList frm = new ArrayList();
frm.Add(stp1);
frm.Add(stp2);
frm.Add(stp3);
frm.Add(stp4);
MailControl.MailInfoController wizard = new MailControl.MailInfoController(ref frm);
wizard.BeginWizard();
}
注:这样就可以了,不过该程序没有对收集的信息进行保存及其他处理
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace UserControl
{
public partial class MailConfigureStep4 : MailControl.MailInfoBase
{
public MailConfigureStep4()
{
InitializeComponent();
}
protected override void UpdataInfo()
{
this.controller.info.UsrName = UsrName.Text;
this.controller.info.Password = Password.Text;
this.controller.info.SPA = SPA.Checked;
}
}
}
MailConfigureStep4.designer.cs
namespace UserControl
{
partial class MailConfigureStep4
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
Windows 窗体设计器生成的代码
private System.Windows.Forms.Button TestConfigure;
public System.Windows.Forms.CheckBox SPA;
private System.Windows.Forms.Label label5;
public System.Windows.Forms.TextBox Password;
public System.Windows.Forms.TextBox UsrName;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
}
}
添加完如上所述的4个子窗体后,
在该项目的Form1中添加一个按钮,设置点击该按钮时的事件如下:
private void 邮箱配置ToolStripMenuItem2_Click(object sender, EventArgs e)
{
MailConfigureStep1 stp1 = new MailConfigureStep1();
MailConfigureStep2 stp2 = new MailConfigureStep2();
MailConfigureStep3 stp3 = new MailConfigureStep3();
MailConfigureStep4 stp4 = new MailConfigureStep4();
ArrayList frm = new ArrayList();
frm.Add(stp1);
frm.Add(stp2);
frm.Add(stp3);
frm.Add(stp4);
MailControl.MailInfoController wizard = new MailControl.MailInfoController(ref frm);
wizard.BeginWizard();
}注:这样就可以了,不过该程序没有对收集的信息进行保存及其他处理


浙公网安备 33010602011771号