像c#这种语言
现在 可以看到有 3个cs源文件
Form1.cs
Form1.Designer.cs
Program.cs
Form1.Designer.cs
Program.cs
前两个文件是一个类:::::前面的两个源文件用到了partial关键词
而Program.cs这个类 有Main方法!!!是程序的入口!
而 Form1.Designer.cs这个类是第一个类的 界面初始化,也就是说在是设计视图下设置的代码,自动在Form1.Designer.cs这个类中,而我无须去修改这个类
只需修改Form1.cs这个类!
这也是在界面设计的时候特有的!
- namespace WinFormHello
- {
- partial class Form1
- {
- /// <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()
- {
- this.label1 = new System.Windows.Forms.Label();
- this.userName = new System.Windows.Forms.TextBox();
- this.OK = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(33, 42);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(95, 12);
- this.label1.TabIndex = 0;
- this.label1.Text = "Enter Your Name";
- //
- // userName
- //
- this.userName.Location = new System.Drawing.Point(35, 127);
- this.userName.Name = "userName";
- this.userName.Size = new System.Drawing.Size(100, 21);
- this.userName.TabIndex = 1;
- this.userName.Text = "here";
- //
- // OK
- //
- this.OK.Location = new System.Drawing.Point(177, 127);
- this.OK.Name = "OK";
- this.OK.Size = new System.Drawing.Size(75, 23);
- this.OK.TabIndex = 2;
- this.OK.Text = "OK";
- this.OK.UseVisualStyleBackColor = true;
- this.OK.Click += new System.EventHandler(this.OK_Click);
- //
- // Form1
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(273, 183);
- this.Controls.Add(this.OK);
- this.Controls.Add(this.userName);
- this.Controls.Add(this.label1);
- this.Name = "Form1";
- this.Text = "Form1";
- this.ResumeLayout(false);
- this.PerformLayout();
- }
- #endregion
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.TextBox userName;
- private System.Windows.Forms.Button OK;
- }
- }
转载于:https://blog.51cto.com/wyq200704/528107