开发者

Cycling through TabControl tabs while not having focus on it

开发者 https://www.devze.com 2023-04-06 03:11 出处:网络
I started with my first WinForms project, and bu开发者_Go百科mped into a small problem on the way.

I started with my first WinForms project, and bu开发者_Go百科mped into a small problem on the way.

I have a Form with a TabControl and some buttons outside it.

The problem is when i have a button focused and press Ctrl-Tab - nothing happens. But if you open, for instance, properties window of a file in explorer, you can cycle through tabs using Ctrl-Tab no matter which element has the focus.

So what is the right way to make such behavior? I mean, i can do Form.KeyPreview = true and write handlers myself, but is there a better way to do this?


As far as I know, the correct way is the one you mentioned yourself i.e. set Form.KeyPreview = true and write private Form1_KeyDown(object sender, KeyEventArgs e) handler to switch tabs.

0

精彩评论

暂无评论...
验证码 换一张
取 消