如何截取TAB键preSS在C#prevent标准焦点变化标准、焦点、TAB、preSS

由网友(从初见之欢到久爱不厌)分享简介:通常,当pressing焦点更改到指定的Tab键顺序的下一个控件TAB键。我想prevent而拥有TAB键做别的事情。就我而言,我想从一个组合框更改焦点到一个完全不同的控制。我不能设置Tab顺序做到这一点。我需要以编程方式做到这一点。任何想法如何?这似乎是KeyDown和关键preSS事件不能正确处理TAB键。谢谢你...

通常,当pressing焦点更改到指定的Tab键顺序的下一个控件TAB键。我想prevent而拥有TAB键做别的事情。就我而言,我想从一个组合框更改焦点到一个完全不同的控制。我不能设置Tab顺序做到这一点。我需要以编程方式做到这一点。任何想法如何?这似乎是KeyDown和关键preSS事件不能正确处理TAB键。 谢谢你。

Normally when pressing the TAB key you change the focus to the next control in the given tab order. I would like to prevent that and have the TAB key do something else. In my case I'd like to change focus from a combobox to a completely different control. I can't do this by setting the tab order. I need to do this programatically. Any idea how? It seems like the KeyDown and KeyPress events can't handle TAB key correctly. Thanks.

推荐答案

覆盖 ProcessDialogKey ProcessTabKey 窗体上和你要取决于其控制的重点是逻辑。

Override ProcessDialogKey or ProcessTabKey on your Form and do the logic you want depending on which control is focused.

阅读全文

相关推荐

最新文章