简体   繁体   English

如何设置Winform文本框字段焦点,以便用户可以通过单击“选项卡”按钮来浏览它们?

[英]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.

相关问题 如何设置我的winform按钮,以便我可以单击按钮或按Enter键 - How can I set up my winform button so that I can either click the button or press enter 如何将焦点设置到选项卡视图选择的视图(用户控件)中的文本框 - How to set focus to a textbox in a View (User control) selected by a tab view 如何在winform c#中禁用按钮时将焦点设置在按钮上? - How to set focus on button while button is disabled in winform c#? 让用户在 winform 弹出时开始输入,而无需单击文本框 - Let user start typing when winform pops up without them having to click on the textbox 如何在WPF中设置TextBox的焦点 - How can I set the focus of a TextBox in WPF 如何通过单击另一个用户控件中的按钮来在用户控件的文本框中显示一些文本? - How can I show some text on a textbox in a user control by clicking a button in another user control? 在winform应用程序中单击按钮后,如何将焦点返回到上次使用的控件? - How do you return the focus to the last used control after clicking a button in a winform app? 在C#winform中加载用户控件时,将焦点放在文本框中 - put focus in textbox when user control is load in C# winform 如何在不关注焦点的情况下单击WinForm? - How to click through a WinForm, without taking focus? 如何在WPF中单击按钮来初始化焦点并将文本框设置为文本框 - How to initialize and set focus to textbox in a button click in WPF
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM