创建跨容器标签索引 [英] Create a Cross-Container Tab Index

查看:23
本文介绍了创建跨容器标签索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个似乎无法解决的小问题.问题出在 WinForm 中,我有几个容器(TabControls、Panels...).

I'm facing a little problem I can't seem to solve. The problem is in an WinForm I have several containers (TabControls, Panels, ...).

控件中的 Tab 顺序工作正常(当然).但是现在客户要求更改 taborder 以从第一个容器(当前 tabindex 0,0,1)中的文本框跳转到另一个容器(当前 tabindex 0,1,0,1)中的控件.

The Tab-order within the controls work fine (of course). But now a customer asked to change the taborder to jump from a textbox in the first container (current tabindex 0,0,1) to a control in another container (current tabindex 0,1,0,1).

我的第一种方法是将第二个的 tabindex 设置为 0,0,1,1 但没有效果.选项卡从 0,0,1 跳到 0,0,2.

My first approach was setting the tabindex of the second to 0,0,1,1 but with no effect. The tab jumps from 0,0,1 to 0,0,2.

我也尝试了其他几种组合,但没有结果.

I tried a couple of other combinations too but with no result.

谁能给我一些提示,我可以如何解决这个问题?

Can anybody provide me with hints how I might solve this problem?

PS:0,0,0 代表包含控件的容器,以防万一这是不清楚的

PS: the 0,0,0 stands for the containers that contain the control just in case this is not clear

推荐答案

您可以使用 离开该控件的事件,并在后面的代码中手动设置焦点来做到这一点.

You could work with the Leave event of that Control, and manually set focus in the code behind to do this.

private void textBox1_Leave(object sender, System.EventArgs e)
{
    textBox2.Focus();
}

这篇关于创建跨容器标签索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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