窗体页面命名一般以Frm开头, 例如: FrmUser
窗体页面添加后一般分为:
FrmUser.cs[设计] 窗体设计类(看到的是窗体设计),如果点击查看源代码将定位到FrmUser.cs部分类
FrmUser.Designer.cs 窗体布局代码,自动生成对应的控件代码
FrmUser.resx 窗体的资源
进入FrmUser.cs部分类:
public partial class FrmUser : Form
{
public FrmUser()
{
InitializeComponent();
}
}
所有窗体页面类继承Form类,并且有一个无参构造函数, 点击进入InitializeComponent(), 显示的是Form页面的所有控件信息,也是窗体类的部分类
partial class FrmUser
{
/// <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);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmUser));
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// textBox1
//
resources.ApplyResources(this.textBox1, "textBox1");
this.textBox1.Name = "textBox1";
//
// button1
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
resources.ApplyResources(this.button1, "button1");
this.button1.Name = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
resources.ApplyResources(this.button2, "button2");
this.button2.Name = "button2";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// FrmUser
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ButtonShadow;
this.CancelButton = this.button2;
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Name = "FrmUser";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
}
网友评论