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.
精彩评论