大家好~~我才学C#!       C#中好多问题都不懂~~尤其是那些自动生成的代码,
大伙帮忙解释哈下面这些代码都起了些什么作用? private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();// 这个是干什么的?布局管理器吗?????
// 
// button1
// 
this.button1.Location = new System.Drawing.Point(0, 0);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "button1";
// 
// Form1
// 
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);//这个呢?也不知道是干什么的?
this.ClientSize = new System.Drawing.Size(292, 273);//这个也不知道!
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false); } 还有这个方法?是干什么的啊?
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null) 
{
components.Dispose();
}
}
base.Dispose( disposing );
}

解决方案 »

  1.   

    protected override void Dispose( bool disposing )
    這個是你退出時用的,用來釋放一些資源。關閉些進程等。例如你點form右上角的x,就執行此函數。
    this.AutoScaleBaseSize 是默認的,你不用管,是自動獲取form的縮放的,你把數值改改就可以看到效果了。
    this.ClientSize 就是你初始時form的大小了