Key repetition

  • Thread starter Thread starter Romain TAILLANDIER
  • Start date Start date
R

Romain TAILLANDIER

Hi group

I have a control looking like a TrackBar, a bar, with a cursor.
I need when the user push the left arrow of his keyboard, the cursor
move left until the key released.
I have overloaded the OnKeyDown method like this :

protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);

switch(e.KeyCode)
{
case Keys.A :
this.SelectedBlock--;
break;
default:
break;
}
}

It work very good with the A Key, but the event for left arrow doesn't
fire !
only the OnKeyUp is fired by the Left Arrow key.

I can't implement the repetition keystroke for arrows, or control,
shift ....

However, the ListView control for exemple allow me to scroll all the
list by push the down arrow, without release it.

How to make the repetition of the left arrow key ?
Thanks

ROM
 
Read the Remarks section of the Control.KeyDown event.

If you're using 2.0 you can try the Control.PreviewKeyDown event, from a
quick test it seems to be working with the arrow keys.
 
Back
Top