两种方法:
1 在Load中设置
this.ActiveControl = this.textBox;
2 this.textBox.Focus();
但在Form_Load设置会无效, 可在Form_Paint()中设置.
本文介绍了在Windows Forms应用程序中,如何使用两种方法使TextBox控件获得焦点。第一种方法是在Load事件中设置this.ActiveControl属性指向textBox;第二种方法是使用textBox.Focus(),但需注意在Form_Load中设置可能无效,建议在Form_Paint事件中调用。
两种方法:
1 在Load中设置
this.ActiveControl = this.textBox;
2 this.textBox.Focus();
但在Form_Load设置会无效, 可在Form_Paint()中设置.
转载于:https://www.cnblogs.com/libiao/archive/2009/10/14/1583331.html
1030
2129

被折叠的 条评论
为什么被折叠?