1、程序添加控件
TextBox myText = new TextBox();
myText.Location = new Point(25,25);
myText.Text = "textbox ";
Label label = new Label();
label.Width = 400;
label.Text = "welcome to the label";
this.Controls.Add(myText);
this.Controls.Add(label);
2、acceptbutton
acceptbutton 是指当按下Enter键,就会激发button1按钮的click事件,与点击按钮的结果是一样的
this.AcceptButton= button1;
3、CancelButton
cancelbutton按钮,通过设置CancelButton属性,可以设置窗体的“取消”按钮。如果设置该属性,则按下“ESC”键就相当于点击了该按钮
this.CancelButton = button1;
4、密码框
//自己手动设置密码的显示符号
TextBox myText = new TextBox();