新建一个项目中添加四个继承于MailInfoBase的窗体。
MailConfigureStep1.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 MailConfigureStep1 : MailControl.MailInfoBase
![]()
{
public MailConfigureStep1()
![]()
{
InitializeComponent();
}
protected override void UpdataInfo()
![]()
{
this.controller.info.NickName = NickName.Text;
}
}
}
MailConfigureStep1.designer.cs
namespace UserControl
![]()
![]()
{
partial class MailConfigureStep1
![]()
{
![]()
/**//// <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 窗体设计器生成的代码#region Windows 窗体设计器生成的代码
![]()
![]()
/**//// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
![]()
{
this.label18 = new System.Windows.Forms.Label();
this.NickName = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.label18);
this.panel1.Controls.Add(this.NickName);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.SetChildIndex(this.btnGoNext, 0);
this.panel1.Controls.SetChildIndex(this.btnGoPrev, 0);
this.panel1.Controls.SetChildIndex(this.btnOver, 0);
this.panel1.Controls.SetChildIndex(this.btnCancel, 0);
this.panel1.Controls.SetChildIndex(this.label1, 0);
this.panel1.Controls.SetChildIndex(this.label2, 0);
this.panel1.Controls.SetChildIndex(this.label3, 0);
this.panel1.Controls.SetChildIndex(this.NickName, 0);
this.panel1.Controls.SetChildIndex(this.label18, 0);
//
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(161, 194);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(59, 12);
this.label18.TabIndex = 19;
this.label18.Text = "例如:光光";
//
// NickName
//
this.NickName.Location = new System.Drawing.Point(163, 154);
this.NickName.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.NickName.Name = "NickName";
this.NickName.Size = new System.Drawing.Size(167, 21);
this.NickName.TabIndex = 18;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(90, 154);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(47, 17);
this.label3.TabIndex = 17;
this.label3.Text = "显示名:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(54, 78);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(342, 34);
this.label2.TabIndex = 16;
this.label2.Text = "当您发送邮件时,您的姓名将出现在外发邮件的\"发件人\"字段。\r\n请键入您想显示的名称。\r\n";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(53, 36);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(68, 20);
this.label1.TabIndex = 15;
this.label1.Text = "您的姓名:";
//
// MailConfigureStep1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.ClientSize = new System.Drawing.Size(501, 331);
this.Name = "MailConfigureStep1";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
![]()
}
![]()
#endregion
![]()
private System.Windows.Forms.Label label18;
public System.Windows.Forms.TextBox NickName;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
}
}
MailConfigureStep2.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 MailConfigureStep2 : MailControl.MailInfoBase
![]()
{
public MailConfigureStep2()
![]()
{
InitializeComponent();
}
protected override void UpdataInfo()
![]()
{
this.controller.info.Email = Email.Text;
}
}
}
![]()
MailConfigureStep2.designer.cs
namespace UserControl
![]()
![]()
{
partial class MailConfigureStep2
![]()
{
![]()
/**//// <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 窗体设计器生成的代码#region Windows 窗体设计器生成的代码
![]()
![]()
/**//// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
![]()
{
this.label4 = new System.Windows.Forms.Label();
this.Email = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.Email);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.SetChildIndex(this.btnGoNext, 0);
this.panel1.Controls.SetChildIndex(this.btnGoPrev, 0);
this.panel1.Controls.SetChildIndex(this.btnOver, 0);
this.panel1.Controls.SetChildIndex(this.btnCancel, 0);
this.panel1.Controls.SetChildIndex(this.label1, 0);
this.panel1.Controls.SetChildIndex(this.label2, 0);
this.panel1.Controls.SetChildIndex(this.label3, 0);
this.panel1.Controls.SetChildIndex(this.Email, 0);
this.panel1.Controls.SetChildIndex(this.label4, 0);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.Location = new System.Drawing.Point(202, 183);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(150, 17);
this.label4.TabIndex = 9;
this.label4.Text = "例如:someone@126.com";
//
// Email
//
this.Email.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Email.Location = new System.Drawing.Point(202, 155);
this.Email.Name = "Email";
this.Email.Size = new System.Drawing.Size(157, 23);
this.Email.TabIndex = 8;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(100, 155);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(83, 17);
this.label3.TabIndex = 7;
this.label3.Text = "电子邮件地址:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(52, 94);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(308, 17);
this.label2.TabIndex = 6;
this.label2.Text = "您的电子邮件地址是别人用来给你发送电子邮件的地址。";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("微软雅黑", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(50, 36);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(87, 19);
this.label1.TabIndex = 5;
this.label1.Text = "电子邮件地址";
//
// MailConfigureStep2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.ClientSize = new System.Drawing.Size(501, 331);
this.Name = "MailConfigureStep2";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
![]()
}
![]()
#endregion
![]()
private System.Windows.Forms.Label label4;
public System.Windows.Forms.TextBox Email;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
}
}
![]()
MailConfigureStep3.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 MailConfigureStep3 : MailControl.MailInfoBase
![]()
{
public MailConfigureStep3()
![]()
{
InitializeComponent();
}
protected override void UpdataInfo()
![]()
{
this.controller.info.Pop3Server = pop3server.Text;
this.controller.info.Port = Port.Text;
this.controller.info.SmtpServer = smtpserver.Text;
}
}
}
![]()
MailConfigureStep3.designer.cs
namespace UserControl
![]()
![]()
{
partial class MailConfigureStep3
![]()
{
![]()
/**//// <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 窗体设计器生成的代码#region Windows 窗体设计器生成的代码
![]()
![]()
/**//// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
![]()
{
this.Port = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.smtpserver = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.pop3server = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.Port);
this.panel1.Controls.Add(this.label6);
this.panel1.Controls.Add(this.smtpserver);
this.panel1.Controls.Add(this.label5);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.pop3server);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.SetChildIndex(this.btnGoNext, 0);
this.panel1.Controls.SetChildIndex(this.btnGoPrev, 0);
this.panel1.Controls.SetChildIndex(this.btnOver, 0);
this.panel1.Controls.SetChildIndex(this.btnCancel, 0);
this.panel1.Controls.SetChildIndex(this.label1, 0);
this.panel1.Controls.SetChildIndex(this.label2, 0);
this.panel1.Controls.SetChildIndex(this.label3, 0);
this.panel1.Controls.SetChildIndex(this.pop3server, 0);
this.panel1.Controls.SetChildIndex(this.label4, 0);
this.panel1.Controls.SetChildIndex(this.label5, 0);
this.panel1.Controls.SetChildIndex(this.smtpserver, 0);
this.panel1.Controls.SetChildIndex(this.label6, 0);
this.panel1.Controls.SetChildIndex(this.Port, 0);
//
// Port
//
this.Port.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Port.Location = new System.Drawing.Point(308, 128);
this.Port.Name = "Port";
this.Port.Size = new System.Drawing.Size(100, 23);
this.Port.TabIndex = 24;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label6.Location = new System.Drawing.Point(266, 132);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(35, 17);
this.label6.TabIndex = 23;
this.label6.Text = "端口:";
//
// smtpserver
//
this.smtpserver.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.smtpserver.Location = new System.Drawing.Point(78, 218);
this.smtpserver.Name = "smtpserver";
this.smtpserver.Size = new System.Drawing.Size(154, 23);
this.smtpserver.TabIndex = 22;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label5.Location = new System.Drawing.Point(76, 193);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(116, 17);
this.label5.TabIndex = 21;
this.label5.Text = "我的SMTP服务器是:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.Location = new System.Drawing.Point(74, 169);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(188, 17);
this.label4.TabIndex = 20;
this.label4.Text = "SMTP是您用来发送邮件的服务器:";
//
// pop3server
//
this.pop3server.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.pop3server.Location = new System.Drawing.Point(78, 128);
this.pop3server.Name = "pop3server";
this.pop3server.Size = new System.Drawing.Size(154, 23);
this.pop3server.TabIndex = 19;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(74, 106);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(138, 17);
this.label3.TabIndex = 18;
this.label3.Text = "我的POP3邮件服务器是:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(51, 71);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(186, 17);
this.label2.TabIndex = 17;
this.label2.Text = "POP3是您用来接收邮件的服务器:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("微软雅黑", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(51, 27);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(113, 19);
this.label1.TabIndex = 16;
this.label1.Text = "电子邮件服务器名";
//
// MailConfigureStep3
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.ClientSize = new System.Drawing.Size(501, 331);
this.Name = "MailConfigureStep3";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
![]()
}
![]()
#endregion
![]()
public System.Windows.Forms.TextBox Port;
private System.Windows.Forms.Label label6;
public System.Windows.Forms.TextBox smtpserver;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
public System.Windows.Forms.TextBox pop3server;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
}
}
![]()