public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button2;
public Form1()
{
TextBox textBox2=new TextBox() ;
Button button2=new Button ();
button2.Click +=new EventHandler(button2_click);
}
private void InitializeComponent()
{
this.textBox2 = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(88, 72);
this.textBox2.Name = "textBox2";
this.textBox2.TabIndex = 0;
this.textBox2.Text = "textBox2";
//
// button2
//
this.button2.Location = new System.Drawing.Point(80, 136);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(96, 24);
this.button2.TabIndex = 1;
this.button2.Text = "button2";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.button2);
this.Controls.Add(this.textBox2);
this.Name = "Form1";
this.ResumeLayout(false);
}
private void button2_click(object sender,EventArgs evargs){
textBox2.Text ="click me!";
}
static void Main()
{
Application.Run(new Form1());
}
}
云形式美什么问题就是看不见那些控件了,这是怎么啦?我是先画的控件然后携代码的