[英]How to Set Up Winform Textbox Field Focus so a User Can Go Through Them by Clicking Tab Button?
UI is created in VS 2008. I'm using C# .... I need to let the user move/focus between text fields from top to bottom by clicking tab button. UI是在VS 2008中创建的。我正在使用C#...。我需要通过单击选项卡按钮让用户从上至下在文本字段之间移动/集中。 How can i do it?
我该怎么做?
On the Layout toolbar (will normally show up if you're in Design View) click on the buttom on the most right (it's called tab order). 在“布局”工具栏上(如果在“设计视图”中,通常会显示)上单击最右边的按钮(称为“标签顺序”)。
Now on every element on your designer will come up a little box with a number. 现在,设计师的每个元素都会出现一个带有数字的小盒子。 Just click all your elements in the order you like and they will automatically be re-ordered.
只需按您喜欢的顺序单击所有元素,它们就会自动重新排序。
If you like to do it manually, just take ho1 advice and change the property manually. 如果您想手动执行此操作,只需接受ho1建议并手动更改属性。
You just set up the TabIndex
property properly, so that it's sequential from top to bottom. 您只需正确设置
TabIndex
属性,即可使其从上到下是连续的。 Then it'll work automatically and you won't need any code to move around the focus. 然后它将自动运行,并且您不需要任何代码就可以移动焦点。
So in other words, set the top TextBox
TabIndex
to 1, the next one you set to 2 etc and then one at the bottom will have the highest number (of the textboxes, you probably want to have even higher indexes for any OK buttons and similar so that the user can jump to them after editing all the textboxes). 因此,换句话说,将顶部的
TextBox
TabIndex
设置为1,将下一个设置为2,以此类推,然后在底部的一个将具有最高的编号(在文本框中,您可能希望对所有OK按钮具有更高的索引,类似,以便用户可以在编辑所有文本框后跳至它们。
You can find more info about it here: 您可以在此处找到有关它的更多信息:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.tabindex.aspx http://msdn.microsoft.com/zh-CN/library/system.windows.forms.control.tabindex.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.