[.net] scrollbar stealing keyboard input
I have placed a couple of scrollbars over a custom control, the problem is that these bars seems to receive focus constantly , stealing keyboard inputs for themselves.
Is there a way to configure these controls so that they ignore focus events or keypresses?
thanks
If the problem is what I think it is, then you need to make sure that the control that is meant to receive the key presses indicates that it does. In WinForms, you'd override the IsInputKey method, like this:
That will ensure that the control receives events from the cursor keys and that they won't be sent to the scrollbars instead.
protected override bool IsInputKey(Keys keyData) { switch (keyData) { case Keys.Up: case Keys.Down: case Keys.Left: case Keys.Right: return true; default: return base.IsInputKey(keyData); } }
That will ensure that the control receives events from the cursor keys and that they won't be sent to the scrollbars instead.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement