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. How can i do it?
UI是在VS 2008中创建的。我正在使用C#....我需要让用户通过单击选项卡按钮从上到下移动/聚焦文本字段。我该怎么做?
2 个解决方案
#1
2
You just set up the TabIndex
property properly, so that it's sequential from top to bottom. Then it'll work automatically and you won't need any code to move around the focus.
您只需正确设置TabIndex属性,使其从上到下依次排列。然后它会自动运行,你不需要任何代码来移动焦点。
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/en-us/library/system.windows.forms.control.tabindex.aspx
#2
3
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).
在“布局”工具栏上(如果您在“设计视图”中,通常会显示)单击最右边的按钮(称为Tab键顺序)。
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建议并手动更改属性即可。
#1
2
You just set up the TabIndex
property properly, so that it's sequential from top to bottom. Then it'll work automatically and you won't need any code to move around the focus.
您只需正确设置TabIndex属性,使其从上到下依次排列。然后它会自动运行,你不需要任何代码来移动焦点。
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/en-us/library/system.windows.forms.control.tabindex.aspx
#2
3
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).
在“布局”工具栏上(如果您在“设计视图”中,通常会显示)单击最右边的按钮(称为Tab键顺序)。
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建议并手动更改属性即可。