|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Key repetitionI 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. Show quote "Romain TAILLANDIER" <romaintailland***@gmail.com> wrote in message news:1164209262.257808.132520@k70g2000cwa.googlegroups.com... > 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 >
Other interesting topics
|
|||||||||||||||||||||||