C#Windows窗体Tab顺序 [英] c# windows form Tab Order

查看:61
本文介绍了C#Windows窗体Tab顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#项目中有一个保留学生信息的Windows窗体.我抓到了图像:

I have a windows form in C# project that keeps Student Info. I caught the image:

我想按以下顺序添加数据,但是当我向姓"文本框输入数据时,"TAB"按钮跳到电子邮件"文本框,然后跳到电话号码"文本框,最后跳到出生日期" DateTimePicker.

I want to add data with sequential order as follows but when I enter data to Surname textbox, TAB button jumps to E-Mail textbox, then Phone Number textbox and lastly to Date of Birth DateTimePicker.

除这些文本框外,我在窗体上将所有控件的TabStop属性设置为"False".然后,按照我的意图,我通过Properties节按如下方式排列了它们的TabOrder:0,1,2...但是顺序是按照我上面写的.然后,我通过菜单栏上的视图"打开了Tab顺序功能..我单击了要按顺序使用的所有控件,但没有用.窗体和选项卡按钮与以前一样.我在下面捕获了Tab Order功能图像:

I made all control's TabStop property "False" on the form except these textboxes. And I arranged their TabOrder via Properties Section as follows 0,1,2.. as I intented. But the order followed as I wrote above. Then I opened Tab Order function via "View" on menu strip.. I clicked all controls which I wanted to use in order, but no use. The form and Tab button act as before. I caught Tab Order function image below:

我现在该怎么办?

推荐答案

TabIndex对于控件是同一父级的同级兄弟很重要.但是,如果您的TextBox和ComboBox控件分别位于不同的父控件中,则它们的父控件必须具有正确的TabIndex.

TabIndex is important for controls which are siblings of the same parent. However, if your TextBox and ComboBox controls are each inside different parents then their parent controls must have a the proper TabIndex.

在Windows窗体设计器中,您可以通过调出文档大纲来查看哪些控件是哪些面板的子控件.转到查看->其他Windows->文档大纲.

In the Windows Forms Designer you can see which controls are children of which panels by bringing up the Document Outline. Go to View -> Other Windows -> Document Outline.

如果每个TextBox或ComboBox都直接位于父级内部,则其TabIndex无关紧要,它可以为0.需要按顺序排列的是父级(可能是父级的父级的)TabIndex.

If each TextBox or ComboBox is directly inside a parent then its TabIndex doesn't matter, it can be 0. It's the parent (and possibly the parent's parent's) TabIndex which needs to be in order.

这篇关于C#Windows窗体Tab顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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