KeyPress
-
I wanna check for pressing arrow keys in
KeyPress
event. How can I do it? :) Thanks Mazy "The path you tread is narrow and the drop is shear and very high, The ravens all are watching from a vantage point near by, Apprehension creeping like a choo-train uo your spine, Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd -
I wanna check for pressing arrow keys in
KeyPress
event. How can I do it? :) Thanks Mazy "The path you tread is narrow and the drop is shear and very high, The ravens all are watching from a vantage point near by, Apprehension creeping like a choo-train uo your spine, Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd -
Thanks :) Mazy "The path you tread is narrow and the drop is shear and very high, The ravens all are watching from a vantage point near by, Apprehension creeping like a choo-train uo your spine, Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
-
ez2 wrote: if(e.KeyCode == Keys.Right) Sorry,It doesn't exist in
System.Windows.Forms.KeyPressEventArgs
,So How can I use it?:confused: Mazy "The path you tread is narrow and the drop is shear and very high, The ravens all are watching from a vantage point near by, Apprehension creeping like a choo-train uo your spine, Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd -
ez2 wrote: if(e.KeyCode == Keys.Right) Sorry,It doesn't exist in
System.Windows.Forms.KeyPressEventArgs
,So How can I use it?:confused: Mazy "The path you tread is narrow and the drop is shear and very high, The ravens all are watching from a vantage point near by, Apprehension creeping like a choo-train uo your spine, Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floydmazdak, I just checked and your right. It looks as though keyPressEventArgs only handles characters (i.e. e.KeyChar returns a char) and not other keys like ALT, Arrows, etc. Not sure why that is so I will do some checking. Alternatively, you could use the Keydown event which does have a KeyEventArgs and you can trap additional keys. In that case, if(e.KeyCode == Keys.Right) should work. I need some clarification myself on keydown vs. keypress anyway so I will let you know what I find.
-
mazdak, I just checked and your right. It looks as though keyPressEventArgs only handles characters (i.e. e.KeyChar returns a char) and not other keys like ALT, Arrows, etc. Not sure why that is so I will do some checking. Alternatively, you could use the Keydown event which does have a KeyEventArgs and you can trap additional keys. In that case, if(e.KeyCode == Keys.Right) should work. I need some clarification myself on keydown vs. keypress anyway so I will let you know what I find.
jap - thats the way it goes. keypressed is somewhat focussing on characters (in fact, the type of the KeyChar-property is char) special keys (like arrows/functionkeys/etc.) you can only handle using keyup/keydown (the KeyCode-property in there is of the Keys type) :wq