简体   繁体   English

无法将焦点设置在ToolStrip按钮上

[英]Unable to set focus on ToolStrip button

I have tried to research this all morning and found no solution that worked for me. 我整个上午都在尝试研究,没有找到适合我的解决方案。

I have a ToolStrip , with several buttons on it. 我有一个ToolStrip ,上面有几个buttons I am unable to get figure out how to select any of the buttons when using tab . 使用tab时,我无法弄清楚如何选择任何按钮。 I did find that it would systematically select the toolstrip but showed no visual indication of that. 我确实发现它会系统地选择toolstrip但没有显示任何视觉效果。 I only found this out by hitting the left arrow key each time I hit tab. 我每次单击选项卡时都单击left arrow key才发现此问题。

So my question is, how can I get one button on the toolstrip(Button1) to be selected (so that when I would hit enter, it would automatically use the button) by hitting the tab button. 所以我的问题是,如何通过toolstrip(Button1)选项卡按钮来在toolstrip(Button1)上选择一个按钮(以便当我按Enter键时,它将自动使用该按钮)

I have turned the TabStop = True and the TabStop on the main UC is also set to True. 我已将TabStop = True设置为True,并且主UC上的TabStop也设置为True。 I have assigned the ToolStrip a final Index number also. 我还为ToolStrip分配了最终索引号。 But still nothing gets highlight, but it's focused. 但是仍然没有什么是重点,而是重点突出。 I want the Button1 to be focused when I focus the ToolStrip . 当我聚焦ToolStrip时,我希望Button1聚焦。

Thanks for your help in advance! 谢谢您的帮助!

ToolStrip.Focus()

Button.Select()

You cant set focus to any button in toolStrip except first Button or any element. 您不能将焦点设置到toolStrip中的任何按钮,但第一个Button或任何元素除外。 So dont try it. 所以不要尝试。 Its Waste of time...I already tried..that. 浪费时间...我已经尝试过了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM