tab键如何仅关注tabcontrol中的控件。 [英] How does tab key move focus only on controls inside a tabcontrol.

查看:129
本文介绍了tab键如何仅关注tabcontrol中的控件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在父窗体中我放了一个UserControl.Inside这个UC是一个标签控件,在每个标签上都有一些其他控件。我想当焦点在标签控件内时,标签键改变焦点在tabcontrol标签内而不是其他元素在父表单中。



例如:在父表单上有一个tabcontrol&button1.in tabcontrol,有2个选项卡,tab1包含Control1和Control2。 tab2包含Control3和Control4。

当焦点位于Tab1内的On2上时,我按下tab,焦点将转到button1。但是我想把焦点放在tab2里面的control3上。



有什么建议吗?先谢谢

解决方案

你不应该这样做,真的不应该 - 它颠覆了标准窗口流动的焦点,可能会混淆或骚扰您的用户。这肯定会让我感到烦恼!



据我所知,唯一的办法就是从用户控制之外通过检测焦点到达Tab键顺序中的下一个控件,并将其移回到usercontrol中,或者可能通过自己处理最终控件中的TAB而不是让系统执行它。

令人讨厌的代码,令人讨厌的用户体验!

Hi, In a parent form I put a UserControl.Inside this UC is a tab control and On each tab there are some other controls.I want when focus is inside tab control, tab key changed focus inside tabcontrol tabs not other element inside parent form.

for example:on parent form there is a tabcontrol & button1.in tabcontrol,there is 2 tab,tab1 contains Control1 & Control2. tab2 contains Control3 & Control4.
when focus is On Control2 inside tab1, and I press tab,the focus will go on button1.but I want focus go on control3 inside tab2.

any suggest?thanks in advance

解决方案

You shouldn't do that, really you shouldn't - it subverts the standard windows "flow" of focus and will probably either confuse or annoy your users. It would certainly annoy the heck out of me!

As far as I know, the only way to do it is from outside the usercontrol by detecting the focus arriving at the next control in the tab order, and moving it back into the usercontrol, or possibly by handling the TAB in the final control yourself instead of letting the system do it.
Nasty code, for a nasty user experience!


这篇关于tab键如何仅关注tabcontrol中的控件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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