动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > C#应用
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ C#应用 ]的信息

本月文章推荐
.汇总c#.net常用函数和方法集.
.讲述c#中的类型转换.
.C#分析数据库结构,使用XSL模板自.
.C#中使用TextBox控件的两个问题.
.如何把html中的相对路径变成绝对.
.用C#开发.NET CF 蓝牙通信模块.
.C#图像放大问题解决方法.
.C#编程实现在Excel文档中搜索文本.
.把RichTextBox中的文本保存到Sql.
.C#3.0 中对象初始化器(Object In.
.读取指定盘符的硬盘序列号.
.给datagrid的按钮列添加css.
.从DataGridView控件托放数据到Tr.
.序列化和反序列化XML应用程序设置.
.用C#截取指定长度的中英文混合字.
.C#打造自己的文件浏览器.
.js也可以有自定义事件 注入就是这.
.选择 VB.NET 还是 C# ? .
.C#编写发送电子邮件.
.C#算法设计与分析-寻找素数.

C#设计的一个向导程序(Wizard)框架

发表日期:2006-7-14 |


在现实的软件中,经常可以看到一些向导(Wizard)的存在,如何给自己的应用程序实现一个向导呢?
下面给出一个使用面向对象的思想设计出来的应用程序向导框架,虽然很简单,但希望能给人帮助。

 其中有三个比较关键的类,一个是向导窗体要收集的信息封装成的类Information,一个是所有向导窗体都要继承的窗体基类frmBase,还有一个就是最关键的类,向导控制类WizardController。

有了基类frmBase,设计一个子类窗体非常简单,只需从frmBase类中派生一个新窗体,设计完用户界面之后重写其UpdateInfo()方法即可。

所有代码(VS2003版)如下,通俗易懂,不再做说明:

Information类:

using System;

namespace Wizard
{
 /// <summary>
 /// Information 的摘要说明。
 /// </summary>
 public class Information
 {
  public Information()
  {
   //
   // TODO: 在此处添加构造函数逻辑
   //
  }

  //姓名
  public string Name = "";
  //性别
  public bool IsMale = true;
  //学历
  public string EduBackground = "";
  //编程语言
  public string ProgrameLanguage = "";
 }
}

frmBase类:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Wizard
{
 /// <summary>
 /// frmBase 的摘要说明。
 /// </summary>
 public class frmBase : System.Windows.Forms.Form
 {
  private System.Windows.Forms.Panel panel1;
  private System.Windows.Forms.Button btnGoPrev;
  private System.Windows.Forms.Button btnGoNext;
  private System.Windows.Forms.Button btnOver;
  private System.Windows.Forms.Button btnCancel;
  private System.Windows.Forms.Button btnHelp;
  /// <summary>
  /// 必需的设计器变量。
  /// </summary>
  private System.ComponentModel.Container components = null;

  public frmBase()
  {
   //
   // Windows 窗体设计器支持所必需的
   //
   InitializeComponent();

   //
   // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
   //
  }

  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if(components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  #region Windows 窗体设计器生成的代码
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   this.panel1 = new System.Windows.Forms.Panel();
   this.btnGoPrev = new System.Windows.Forms.Button();
   this.btnGoNext = new System.Windows.Forms.Button();
   this.btnOver = new System.Windows.Forms.Button();
   this.btnCancel = new System.Windows.Forms.Button();
   this.btnHelp = new System.Windows.Forms.Button();
   this.panel1.SuspendLayout();
   this.SuspendLayout();
   //
   // panel1
   //
   this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
    | System.Windows.Forms.AnchorStyles.Right)));
   this.panel1.Controls.Add(this.btnHelp);
   this.panel1.Controls.Add(this.btnCancel);
   this.panel1.Controls.Add(this.btnOver);
   this.panel1.Controls.Add(this.btnGoNext);
   this.panel1.Controls.Add(this.btnGoPrev);
   this.panel1.Location = new System.Drawing.Point(0, 202);
   this.panel1.Name = "panel1";
   this.panel1.Size = new System.Drawing.Size(450, 40);
   this.panel1.TabIndex = 0;
   //
   // btnGoPrev
   //
   this.btnGoPrev.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
   this.btnGoPrev.Location = new System.Drawing.Point(25, 8);
   this.btnGoPrev.Name = "btnGoPrev";
   this.btnGoPrev.Size = new System.Drawing.Size(56, 23);
   this.btnGoPrev.TabIndex = 1;
   this.btnGoPrev.Text = "上一步";
   this.btnGoPrev.Click += new System.EventHandler(this.btnGoPrev_Click);
   //
   // btnGoNext
   //
   this.btnGoNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
   this.btnGoNext.Location = new System.Drawing.Point(105, 8);
   this.btnGoNext.Name = "btnGoNext";
   this.btnGoNext.Size = new System.Drawing.Size(56, 23);
   this.btnGoNext.TabIndex = 2;
   this.btnGoNext.Text = "下一步";
   this.btnGoNext.Click += new System.EventHandler(this.btnGoNext_Click);
   //
   // btnOver
   //
   this.btnOver.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
   this.btnOver.Location = new System.Drawing.Point(193, 8);
   this.btnOver.Name = "btnOver";
   this.btnOver.Size = new System.Drawing.Size(56, 23);
   this.btnOver.TabIndex = 3;
   this.btnOver.Text = "完成";
   this.btnOver.Click += new System.EventHandler(this.btnOver_Click);
   //
   // btnCancel
   //
   this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
   this.btnCancel.Location = new System.Drawing.Point(281, 8);
   this.btnCancel.Name = "btnCancel";
   this.btnCancel.Size = new System.Drawing.Size(56, 23);
   this.btnCancel.TabIndex = 4;
   this.btnCancel.Text = "取消";
   this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
   //
   // btnHelp
   //
   this.btnHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
   this.btnHelp.Location = new System.Drawing.Point(369, 8);
   this.btnHelp.Name = "btnHelp";
   this.btnHelp.Size = new System.Drawing.Size(56, 23);
   this.btnHelp.TabIndex = 5;
   this.btnHelp.Text = "帮助";
   //
   // frmBase
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
   this.ClientSize = new System.Drawing.Size(450, 239);
   this.Controls.Add(this.panel1);
   this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
   this.Name = "frmBase";
   this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
   this.panel1.ResumeLayout(false);
   this.ResumeLayout(false);

  }
  #endregion

  public WizardController controller = null;

  public void DisableButton()
  {
   if(this.controller == null)
    return;
   if(this.controller.IsFirstForm)
   {
    this.btnGoPrev.Enabled = false;
   }
   else
   {
    this.btnGoPrev.Enabled = true;
   }
   if(this.controller.IsLastForm)
   {
    this.btnGoNext.Enabled = false;
   }
   else
   {
    this.btnGoNext.Enabled = true;
   }
  }
  protected virtual void UpdateInfo()
  {
 
  }
  protected virtual void GoNext()
  {
   UpdateInfo();
   controller.GoNext();
  }
  protected virtual void GoPrev()
  {
   UpdateInfo();
   controller.GoPrev();
  }
  protected virtual void Finish()
  {
   UpdateInfo();
   controller.FinishWizard();
   this.Visible = false;
  }
  protected virtual void Cancel()
  {
   this.controller.info = null;
   this.Close();
  }

  private void btnGoPrev_Click(object sender, System.EventArgs e)
  {
   GoPrev();
  }

  private void btnGoNext_Click(object sender, System.EventArgs e)
  {
   GoNext();
  }

  private void btnOver_Click(object sender, System.EventArgs e)
  {
   Finish();
  }

  private void btnCancel_Click(object sender, System.EventArgs e)
  {
   Cancel();
  }
 }
}

向导控制器WizardController类:

using System;
using System.Collections;


namespace Wizard
{
 /// <summary>
 /// WizardController 的摘要说明。
 /// </summary>
 public class WizardController
 {
  public WizardController()
  {
   //
   // TODO: 在此处添加构造函数逻辑
   //
   WizardForms.Add(new frmStep1());
   WizardForms.Add(new frmStep2());
   foreach(frmBase frm in WizardForms)
   {
    frm.controller = this;
    frm.DisableButton();
   }
  }
  private ArrayList WizardForms = new ArrayList();
  public Information info = new Information();
  private int curIndex = 0;

  public bool IsFirstForm
  {
   get{ return curIndex == 0;}  
  }
  public bool IsLastForm
  {
   get{return curIndex == this.WizardForms.Count - 1;}
  }
  public void GoNext()
  {
   if(curIndex+1 < WizardForms.Count)
   {
    ((frmBase)WizardForms[curIndex]).Visible = false;
    curIndex++;
   }
   else
   {
    return;
   }
   ((frmBase)WizardForms[curIndex]).Show();
   ((frmBase)WizardForms[curIndex]).DisableButton();
  }
  public void GoPrev()
  {
   if(curIndex-1 >= 0)
   {
    ((frmBase)WizardForms[curIndex]).Visible = false;
    curIndex--;
   }
   else
   {
    return;
   }
   ((frmBase)WizardForms[curIndex]).Show();
   ((frmBase)WizardForms[curIndex]).DisableButton();
  }
  public void BeginWizard()
  {
   ((frmBase)WizardForms[0]).Show();
   ((frmBase)WizardForms[curIndex]).DisableButton();
  }
  public void FinishWizard()
  {
   curIndex = 0;
   Dispose();
  }

  private void Dispose()
  {
   foreach(frmBase frm in WizardForms)
   {
    frm.Close();
   }
  }
 }
}

第一个子窗体:

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace Wizard
{
 public class frmStep1 : Wizard.frmBase
 {
  private System.Windows.Forms.TextBox txtName;
  private System.Windows.Forms.RadioButton rdoMale;
  private System.Windows.Forms.RadioButton radioButton1;
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.Label label2;
  private System.ComponentModel.IContainer components = null;

  public frmStep1()
  {
   // 该调用是 Windows 窗体设计器所必需的。
   InitializeComponent();

   // TODO: 在 InitializeComponent 调用后添加任何初始化
  }

  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  #region 设计器生成的代码
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   this.txtName = new System.Windows.Forms.TextBox();
   this.rdoMale = new System.Windows.Forms.RadioButton();
   this.radioButton1 = new System.Windows.Forms.RadioButton();
   this.label1 = new System.Windows.Forms.Label();
   this.label2 = new System.Windows.Forms.Label();
   this.SuspendLayout();
   //
   // txtName
   //
   this.txtName.Location = new System.Drawing.Point(173, 61);
   this.txtName.Name = "txtName";
   this.txtName.Size = new System.Drawing.Size(152, 21);
   this.txtName.TabIndex = 1;
   this.txtName.Text = "";
   //
   // rdoMale
   //
   this.rdoMale.Checked = true;
   this.rdoMale.Location = new System.Drawing.Point(205, 115);
   this.rdoMale.Name = "rdoMale";
   this.rdoMale.Size = new System.Drawing.Size(40, 24);
   this.rdoMale.TabIndex = 2;
   this.rdoMale.TabStop = true;
   this.rdoMale.Text = "男";
   //
   // radioButton1
   //
   this.radioButton1.Location = new System.Drawing.Point(253, 115);
   this.radioButton1.Name = "radioButton1";
   this.radioButton1.Size = new System.Drawing.Size(32, 24);
   this.radioButton1.TabIndex = 3;
   this.radioButton1.Text = "女";
   //
   // label1
   //
   this.label1.Location = new System.Drawing.Point(125, 64);
   this.label1.Name = "label1";
   this.label1.Size = new System.Drawing.Size(48, 23);
   this.label1.TabIndex = 4;
   this.label1.Text = "姓名";
   //
   // label2
   //
   this.label2.Location = new System.Drawing.Point(0, 0);
   this.label2.Name = "label2";
   this.label2.TabIndex = 5;
   //
   // frmStep1
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
   this.ClientSize = new System.Drawing.Size(450, 239);
   this.Controls.Add(this.label1);
   this.Controls.Add(this.radioButton1);
   this.Controls.Add(this.rdoMale);
   this.Controls.Add(this.txtName);
   this.Controls.Add(this.label2);
   this.Name = "frmStep1";
   this.Controls.SetChildIndex(this.label2, 0);
   this.Controls.SetChildIndex(this.txtName, 0);
   this.Controls.SetChildIndex(this.rdoMale, 0);
   this.Controls.SetChildIndex(this.radioButton1, 0);
   this.Controls.SetChildIndex(this.label1, 0);
   this.ResumeLayout(false);

  }
  #endregion

  protected override void UpdateInfo()
  {
   this.controller.info.Name = txtName.Text.Trim();
   this.controller.info.IsMale = rdoMale.Checked;
  }

 }
}

第二个子窗体:

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace Wizard
{
 public class frmStep2 : Wizard.frmBase
 {
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.Label label2;
  private System.Windows.Forms.ComboBox cbbEduBackground;
  private System.Windows.Forms.CheckBox checkBox1;
  private System.Windows.Forms.CheckBox checkBox2;
  private System.Windows.Forms.CheckBox checkBox3;
  private System.Windows.Forms.CheckBox checkBox4;
  private System.ComponentModel.IContainer components = null;

  public frmStep2()
  {
   // 该调用是 Windows 窗体设计器所必需的。
   InitializeComponent();

   // TODO: 在 InitializeComponent 调用后添加任何初始化
  }

  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  #region 设计器生成的代码
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   this.label1 = new System.Windows.Forms.Label();
   this.label2 = new System.Windows.Forms.Label();
   this.cbbEduBackground = new System.Windows.Forms.ComboBox();
   this.checkBox1 = new System.Windows.Forms.CheckBox();
   this.checkBox2 = new System.Windows.Forms.CheckBox();
   this.checkBox3 = new System.Windows.Forms.CheckBox();
   this.checkBox4 = new System.Windows.Forms.CheckBox();
   this.SuspendLayout();
   //
   // label1
   //
   this.label1.Location = new System.Drawing.Point(98, 72);
   this.label1.Name = "label1";
   this.label1.Size = new System.Drawing.Size(40, 23);
   this.label1.TabIndex = 3;
   this.label1.Text = "学历";
   //
   // label2
   //
   this.label2.Location = new System.Drawing.Point(98, 128);
   this.label2.Name = "label2";
   this.label2.Size = new System.Drawing.Size(64, 23);
   this.label2.TabIndex = 4;
   this.label2.Text = "编程语言";
   //
   // cbbEduBackground
   //
   this.cbbEduBackground.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
   this.cbbEduBackground.Items.AddRange(new object[] {
                  "本科",
                  "硕士",
                  "博士"});
   this.cbbEduBackground.Location = new System.Drawing.Point(170, 68);
   this.cbbEduBackground.Name = "cbbEduBackground";
   this.cbbEduBackground.Size = new System.Drawing.Size(152, 20);
   this.cbbEduBackground.TabIndex = 5;
   //
   // checkBox1
   //
   this.checkBox1.Location = new System.Drawing.Point(166, 123);
   this.checkBox1.Name = "checkBox1";
   this.checkBox1.Size = new System.Drawing.Size(48, 24);
   this.checkBox1.TabIndex = 6;
   this.checkBox1.Text = "C++";
   //
   // checkBox2
   //
   this.checkBox2.Location = new System.Drawing.Point(211, 123);
   this.checkBox2.Name = "checkBox2";
   this.checkBox2.Size = new System.Drawing.Size(48, 24);
   this.checkBox2.TabIndex = 7;
   this.checkBox2.Text = "Java";
   //
   // checkBox3
   //
   this.checkBox3.Location = new System.Drawing.Point(267, 123);
   this.checkBox3.Name = "checkBox3";
   this.checkBox3.Size = new System.Drawing.Size(40, 24);
   this.checkBox3.TabIndex = 8;
   this.checkBox3.Text = "VB";
   //
   // checkBox4
   //
   this.checkBox4.Location = new System.Drawing.Point(312, 123);
   this.checkBox4.Name = "checkBox4";
   this.checkBox4.Size = new System.Drawing.Size(40, 24);
   this.checkBox4.TabIndex = 9;
   this.checkBox4.Text = "C#";
   //
   // frmStep2
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
   this.ClientSize = new System.Drawing.Size(450, 239);
   this.Controls.Add(this.checkBox4);
   this.Controls.Add(this.checkBox3);
   this.Controls.Add(this.checkBox2);
   this.Controls.Add(this.checkBox1);
   this.Controls.Add(this.cbbEduBackground);
   this.Controls.Add(this.label2);
   this.Controls.Add(this.label1);
   this.Name = "frmStep2";
   this.Controls.SetChildIndex(this.label1, 0);
   this.Controls.SetChildIndex(this.label2, 0);
   this.Controls.SetChildIndex(this.cbbEduBackground, 0);
   this.Controls.SetChildIndex(this.checkBox1, 0);
   this.Controls.SetChildIndex(this.checkBox2, 0);
   this.Controls.SetChildIndex(this.checkBox3, 0);
   this.Controls.SetChildIndex(this.checkBox4, 0);
   this.ResumeLayout(false);

  }
  #endregion

  protected override void UpdateInfo()
  {
   this.controller.info.EduBackground = cbbEduBackground.GetItemText(cbbEduBackground.SelectedItem);
   string lang = "";
   foreach(Control ctl in this.Controls)
   {
    if(ctl is CheckBox && ((CheckBox)ctl).Checked)
    {
     lang += ctl.Text + ";";
    }
   }
   this.controller.info.ProgrameLanguage = lang;
  }

 }
}

测试Demo:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Wizard
{
 /// <summary>
 /// frmTest 的摘要说明。
 /// </summary>
 public class frmTest : System.Windows.Forms.Form
 {
  /// <summary>
  /// 必需的设计器变量。
  /// </summary>
  private System.ComponentModel.Container components = null;
  private System.Windows.Forms.Button button1;
  private System.Windows.Forms.Button button2;
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.Label label2;
  private System.Windows.Forms.Label label3;
  private System.Windows.Forms.Label label4;
  private WizardController wizard;

  public frmTest()
  {
   //
   // Windows 窗体设计器支持所必需的
   //
   InitializeComponent();

   //
   // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
   //
  }

  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if(components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  #region Windows 窗体设计器生成的代码
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   this.button1 = new System.Windows.Forms.Button();
   this.button2 = new System.Windows.Forms.Button();
   this.label1 = new System.Windows.Forms.Label();
   this.label2 = new System.Windows.Forms.Label();
   this.label3 = new System.Windows.Forms.Label();
   this.label4 = new System.Windows.Forms.Label();
   this.SuspendLayout();
   //
   // button1
   //
   this.button1.Location = new System.Drawing.Point(48, 216);
   this.button1.Name = "button1";
   this.button1.Size = new System.Drawing.Size(104, 23);
   this.button1.TabIndex = 0;
   this.button1.Text = "显示向导";
   this.button1.Click += new System.EventHandler(this.button1_Click);
   //
   // button2
   //
   this.button2.Location = new System.Drawing.Point(192, 216);
   this.button2.Name = "button2";
   this.button2.Size = new System.Drawing.Size(104, 23);
   this.button2.TabIndex = 1;
   this.button2.Text = "显示信息";
   this.button2.Click += new System.EventHandler(this.button2_Click);
   //
   // label1
   //
   this.label1.Location = new System.Drawing.Point(72, 32);
   this.label1.Name = "label1";
   this.label1.Size = new System.Drawing.Size(232, 23);
   this.label1.TabIndex = 2;
   //
   // label2
   //
   this.label2.Location = new System.Drawing.Point(72, 80);
   this.label2.Name = "label2";
   this.label2.Size = new System.Drawing.Size(224, 23);
   this.label2.TabIndex = 3;
   //
   // label3
   //
   this.label3.Location = new System.Drawing.Point(72, 120);
   this.label3.Name = "label3";
   this.label3.Size = new System.Drawing.Size(232, 23);
   this.label3.TabIndex = 4;
   //
   // label4
   //
   this.label4.Location = new System.Drawing.Point(72, 160);
   this.label4.Name = "label4";
   this.label4.Size = new System.Drawing.Size(232, 23);
   this.label4.TabIndex = 5;
   //
   // frmTest
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
   this.ClientSize = new System.Drawing.Size(344, 261);
   this.Controls.Add(this.label4);
   this.Controls.Add(this.label3);
   this.Controls.Add(this.label2);
   this.Controls.Add(this.label1);
   this.Controls.Add(this.button2);
   this.Controls.Add(this.button1);
   this.Name = "frmTest";
   this.Text = "向导测试";
   this.ResumeLayout(false);

  }
  #endregion
  /// <summary>
  /// 应用程序的主入口点。
  /// </summary>
  [STAThread]
  static void Main()
  {
   Application.Run(new frmTest());
  }

  private void button1_Click(object sender, System.EventArgs e)
  {
   this.wizard = new WizardController();
   this.wizard.BeginWizard();
  }using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Wizard
{
 /// <summary>
 /// frmTest 的摘要说明。
 /// </summary>
 public class frmTest : System.Windows.Forms.Form
 {
  /// <summary>
  /// 必需的设计器变量。
  /// </summary>
  private System.ComponentModel.Container components = null;
  private System.Windows.Forms.Button button1;
  private System.Windows.Forms.Button button2;
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.Label label2;
  private System.Windows.Forms.Label label3;
  private System.Windows.Forms.Label label4;
  private WizardController wizard;

  public frmTest()
  {
   //
   // Windows 窗体设计器支持所必需的
   //
   InitializeComponent();

   //
   // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
   //
  }

  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if(components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  #region Windows 窗体设计器生成的代码
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   this.button1 = new System.Windows.Forms.Button();
   this.button2 = new System.Windows.Forms.Button();
   this.label1 = new System.Windows.Forms.Label();
   this.label2 = new System.Windows.Forms.Label();
   this.label3 = new System.Windows.Forms.Label();
   this.label4 = new System.Windows.Forms.Label();
   this.SuspendLayout();
   //
   // button1
   //
   this.button1.Location = new System.Drawing.Point(48, 216);
   this.button1.Name = "button1";
   this.button1.Size = new System.Drawing.Size(104, 23);
   this.button1.TabIndex = 0;
   this.button1.Text = "显示向导";
   this.button1.Click += new System.EventHandler(this.button1_Click);
   //
   // button2
   //
   this.button2.Location = new System.Drawing.Point(192, 216);
   this.button2.Name = "button2";
   this.button2.Size = new System.Drawing.Size(104, 23);
   this.button2.TabIndex = 1;
   this.button2.Text = "显示信息";
   this.button2.Click += new System.EventHandler(this.button2_Click);
   //
   // label1
   //
   this.label1.Location = new System.Drawing.Point(72, 32);
   this.label1.Name = "label1";
   this.label1.Size = new System.Drawing.Size(232, 23);
   this.label1.TabIndex = 2;
   //
   // label2
   //
   this.label2.Location = new System.Drawing.Point(72, 80);
   this.label2.Name = "label2";
   this.label2.Size = new System.Drawing.Size(224, 23);
   this.label2.TabIndex = 3;
   //
   // label3
   //
   this.label3.Location = new System.Drawing.Point(72, 120);
   this.label3.Name = "label3";
   this.label3.Size = new System.Drawing.Size(232, 23);
   this.label3.TabIndex = 4;
   //
   // label4
   //
   this.label4.Location = new System.Drawing.Point(72, 160);
   this.label4.Name = "label4";
   this.label4.Size = new System.Drawing.Size(232, 23);
   this.label4.TabIndex = 5;
   //
   // frmTest
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
   this.ClientSize = new System.Drawing.Size(344, 261);
   this.Controls.Add(this.label4);
   this.Controls.Add(this.label3);
   this.Controls.Add(this.label2);
   this.Controls.Add(this.label1);
   this.Controls.Add(this.button2);
   this.Controls.Add(this.button1);
   this.Name = "frmTest";
   this.Text = "向导测试";
   this.ResumeLayout(false);

  }
  #endregion
  /// <summary>
  /// 应用程序的主入口点。
  /// </summary>
  [STAThread]
  static void Main()
  {
   Application.Run(new frmTest());
  }

  private void button1_Click(object sender, System.EventArgs e)
  {
   this.wizard = new WizardController();
   this.wizard.BeginWizard();
  }

  private void button2_Click(object sender, System.EventArgs e)
  {
   if(this.wizard != null && this.wizard.info != null)
   {
    this.label1.Text = this.wizard.info.Name;
    if(this.wizard.info.IsMale)
     this.label2.Text = "男";
    else
     this.label2.Text = "女";
    this.label3.Text = this.wizard.info.EduBackground;
    this.label4.Text = this.wizard.info.ProgrameLanguage;
   }
   else
   {
    MessageBox.Show("NULL");
   }
  }
 }
}


  private void button2_Click(object sender, System.EventArgs e)
  {
   if(this.wizard != null && this.wizard.info != null)
   {
    this.label1.Text = this.wizard.info.Name;
    if(this.wizard.info.IsMale)
     this.label2.Text = "男";
    else
     this.label2.Text = "女";
    this.label3.Text = this.wizard.info.EduBackground;
    this.label4.Text = this.wizard.info.ProgrameLanguage;
   }
   else
   {
    MessageBox.Show("NULL");
   }
  }
 }
}


链接地址: http://maxianghui.cnblogs.com/archive/2006/07/13/449896.html

上一篇:Active Directory如何用C#进行增加、删除、修改、查询用户与组织单位 人气:8407
下一篇:在C#中动态调用native dll的导出函数 人气:6065
浏览全部C#的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-8-30 HBcms(宏博cms)内容管理系统 v1.1
2008-8-30 邓西网站帮助系统 v2.3
2008-8-30 破竹CMS v4.0.7.21
2008-8-30 美女写真网图片小偷 v1.5 全站静
2008-8-30 PHP美女写真Cms v1.00
2008-8-30 PHPer.yang情书系统 v1.0
2008-8-30 快乐商城全站源码
2008-8-29 oblog v4.6 build 20080827
2008-8-29 ASBLOG v2.5 bulid 080828
2008-8-23 Mini WinMount V0.4
2008-8-23 Vista优化大师3.11正式版
2008-8-23 Wine 1.13
2008-8-23 KlipFolio 5.0 Build 5899-80
2008-8-23 Windows Sysinternals Desktops
2008-8-23 OneTap Movies1.2破解版
2008-8-23 AnnotaterPDF阅读1.1.503 破解版
2008-8-23 SoundMeter分贝测量仪 v1.0汉化破
2008-8-23 iDrum音乐节拍1.0破解版
  发表评论
姓 名: 验证码:
内 容:
站长工具:网站收录查询 | Google PR查询 | ALEXA排名查询 | CSS在线编辑器 | 广告代码 | Html转换js | js/vbs加密 | md5加密 | 进制转换
实用工具:汉字翻译拼音 | 符号对照表 | 个税计算 | 经典小工具 | 汉字简繁转换 | 普通单位换算 | 公制单位换算 | 生辰老黄历 | 国内电话区号 国家代码与域名缩写 | 文字加密解密 | 健康查询 | 万年历 | 汉字横竖排版 | 手机号码查询 | 计算器 | ip搜索
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報
防水工事·改修工事 フットサル大会 探偵