如何在.net WinForms中设置单选按钮的选项卡顺序 [英] How to set the Tab Order for RadioButtons in .net WinForms

查看:64
本文介绍了如何在.net WinForms中设置单选按钮的选项卡顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我对winforms中的RadioButtons的制表顺序有疑问.我有一个GroupBox,其中有四个Textboxes和五个RadioButtons以及Buttons.当按下选项卡时,RadioButtons选项卡的顺序不起作用.这个怎么做. .




Main GroupBox选项卡顺序0
label1标签顺序0.1
textbox1选项卡顺序0.2
label2标签顺序0.3
textbox2标签顺序0.4

主GroupBox选项卡中的另一个GroupBox顺序为0.5
与组框,我有RadioButtons选项卡顺序0.5.0
RadioButtons选项卡顺序0.5.1
RadioButtons选项卡顺序0.5.2
RadioButtons选项卡顺序0.5.3

在主组"框中

label3标签顺序0.6
textbox3选项卡顺序0.7

还有几个按钮

Button1 Tab顺序0.8
Button2 Tab顺序0.9
Button3制表符顺序0.10


我设置了单选按钮的某些属性,例如TabStop = False

Hi guys, I have a problem with tab order of RadioButtons in winforms. I have a GroupBox, in that four Textboxes and Five RadioButtons and also Buttons . when pressing the tab , RadioButtons tab order don''t work. How to do this. .




Main GroupBox tab order 0
label1 tab order 0.1
textbox1 tab order 0.2
label2 tab order 0.3
textbox2 tab order 0.4

Another GroupBox within the main GroupBox Tab Order 0.5
with groupbox i have RadioButtons Tab Order 0.5.0
RadioButtons Tab Order 0.5.1
RadioButtons Tab Order 0.5.2
RadioButtons Tab Order 0.5.3

in Main Group Box

label3 tab order 0.6
textbox3 tab order 0.7

and also few Buttons

Button1 Tab order 0.8
Button2 Tab order 0.9
Button3 Tab order 0.10


I set the some properties of radioButtons like TabStop =False

Please any one help me.

推荐答案

在设计模式下,您可以通过查看"菜单->设置它. Tab键顺序,或通过工具栏按钮.
请参阅此处: http://msdn.microsoft.com/en-us/library/csz6b8x8.aspx [ ^ ]并注意广播按钮应该在组框中或类似的框中,因此它们的选项卡顺序应类似于5.1、5.2、5.3等.
In design mode, you can set it via the View Menu -> Tab Order, or via the toolbar button.
See here: http://msdn.microsoft.com/en-us/library/csz6b8x8.aspx[^] And note that radio buttons should be in a group box or similar, so their tab orders should be something like 5.1, 5.2, 5.3 and so on.


设置控件的选项卡顺序

在查看"菜单上,单击"Tab顺序".

这将激活表单上的选项卡顺序选择模式.每个控件的左上角都会出现一个数字(代表TabIndex属性).

依次单击控件以建立所需的选项卡顺序.

注意
可以将控件在制表符顺序中的位置设置为大于或等于0的任何值.当出现重复项时,将评估两个控件的z顺序,并将顶部的控件制表为第一个. (z顺序是控件在窗体上沿窗体的z轴[深度]的可视分层.z顺序确定哪些控件位于其他控件的前面.)有关z顺序的详细信息,请参见在Windows窗体上对对象进行分层.
完成后,再次单击视图"菜单上的制表符顺序"以退出制表符顺序模式.

注意
无法获得焦点的控件以及禁用和不可见的控件没有TabIndex属性,并且不包含在选项卡顺序中.当用户按下TAB键时,将跳过这些控件.
或者,可以使用TabIndex属性在属性"窗口中设置制表符顺序.控件的TabIndex属性确定按Tab键顺序放置控件的位置.默认情况下,绘制的第一个控件的TabIndex值为0,第二个控件的TabIndex为1,依此类推.
此外,默认情况下,GroupBox控件具有其自己的TabIndex值,该值是整数. GroupBox控件本身不能在运行时具有焦点.因此,GroupBox中的每个控件都有其自己的十进制TabIndex值,以.0开头.自然地,随着GroupBox控件的TabIndex递增,其中的控件将相应地递增.如果将TabIndex值从5更改为6,则其组中第一个控件的TabIndex值将自动更改为6.0,依此类推.

最后,可以按制表符顺序跳过窗体上许多控件的任何控件.通常,在运行时连续按TAB会按选项卡顺序选择每个控件.通过关闭TabStop属性,可以使控件按照表单的Tab键顺序传递.




参考:


http://msdn.microsoft.com/en-us/library/bd16a8cw (v = vs.80).aspx [
To set the tab order of a control

On the View menu, click Tab Order.

This activates the tab-order selection mode on the form. A number (representing the TabIndex property) appears in the upper-left corner of each control.

Click the controls sequentially to establish the tab order you want.

Note
A control''s place within the tab order can be set to any value greater than or equal to 0. When duplicates occur, the z-order of the two controls is evaluated and the control on top is tabbed to first. (The z-order is the visual layering of controls on a form along the form''s z-axis [depth]. The z-order determines which controls are in front of other controls.) For more information on z-order, see Layering Objects on Windows Forms.
When you have finished, click Tab Order on the View menu again to leave tab order mode.

Note
Controls that cannot get the focus, as well as disabled and invisible controls, do not have a TabIndex property and are not included in the tab order. As a user presses the TAB key, these controls are skipped.
Alternatively, tab order can be set in the Properties window using the TabIndex property. The TabIndex property of a control determines where it is positioned in the tab order. By default, the first control drawn has a TabIndex value of 0, the second has a TabIndex of 1, and so on.

Additionally, by default, a GroupBox control has its own TabIndex value, which is a whole number. A GroupBox control itself cannot have focus at run time. Thus, each control within a GroupBox has its own decimal TabIndex value, beginning with .0. Naturally, as the TabIndex of a GroupBox control is incremented, the controls within it will be incremented accordingly. If you changed a TabIndex value from 5 to 6, the TabIndex value of the first control in its group automatically changes to 6.0, and so on.

Finally, any control of the many on your form can be skipped in the tab order. Usually, pressing TAB successively at run time selects each control in the tab order. By turning off the TabStop property, you can make a control be passed over in the tab order of the form.




reference:


http://msdn.microsoft.com/en-us/library/bd16a8cw(v=vs.80).aspx[^]


这篇关于如何在.net WinForms中设置单选按钮的选项卡顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆