2014-06-11 16 views
3

我有一个winform,我添加了一个2行2列的表格布局面板。 要我添加不同的用户控件有自己的选项卡索引顺序中的每个细胞, 的问题是,它似乎标签指数joind所有形式,意思是:Winforms,如何在同一个表单中分离用户控件的tab索引?

UserControl1 has 4 textboxes with tab index: 0,1,2,3 
UserControl2 has 4 textboxes with tab index: 0,1,2,3 
UserControl3 has 4 textboxes with tab index: 0,1,2,3 
UserControl4 has 4 textboxes with tab index: 0,1,2,3 

当我在UserContrl1我textbox1并按下标签,它将转到UserControl2 textbox1,而不是 转到UserControl1 textbox2。 所有控件都是动态加载的,因此Tab循环索引在循环中计算。 有没有办法告诉窗体只处理用户控制顺序而不是表单的tab键?

回答

1

如果您仍然生成usercontrols,是什么让您不能像这样设置标签索引?

UserControl1 has 4 textboxes with tab index: 0,1,2,3 
UserControl2 has 4 textboxes with tab index: 4,5,6,7 
UserControl3 has 4 textboxes with tab index: 8,9,10,11 
UserControl4 has 4 textboxes with tab index: 12,13,14,15 

另一种猜测是只设置用户控件本身的TabIndex:

UserControl1.TabIndex = 0; 4 textboxes with tab index: 0,1,2,3 
UserControl2.TabIndex = 1; 4 textboxes with tab index: 0,1,2,3 
UserControl3.TabIndex = 2; 4 textboxes with tab index: 0,1,2,3 
UserControl4.TabIndex = 3; 4 textboxes with tab index: 0,1,2,3 
+0

它的运行每次从 –

相关问题