By default, the arrow keys are not handled by a control’s key processing code, but instead are filtered out for focus management. Hence, the control’s KeyDown, KeyUp and KeyPressed events are not hit when you press an arrow. If you want your control to handle these keyboard events, you tell the framework by overriding your control’s IsInputKey method.
protected override bool IsInputKey(Keys key)
{
switch(key)
{
case Keys.Up:
case Keys.Down:
case Keys.Right:
case Keys.Left:
return true;
}
return base.IsInputKey(key);
}
Share with