I have a form with a splitter container. In one pane there are some buttons.
I want to provide specific functionality based on the left and right arrow keys so I have set the form KeyPreview to true and the following for the KeyDown event of the form (it does what I want most of the time):
private void OnKeyDown(object sender, KeyEventArgs e)
if (e.KeyCode == Keys.Left)
e.Handled = true;
Now if any of the buttons on the pane have the focus then this code is never reached, instead the focus cycles through the buttons. This NOT what I want.
I want the arrow keys to always be handled at the form level - how do I do that?