检查方向键何时被按下?
答
后,您可以使用在KeyDown/KeyPress事件刚刚成立的KeyPreview
属性为true窗体加载
。
Private Sub main_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
'40 = ArrowkeyDown 38= ArrowKeyUp
If Not e.KeyValue = 40 AndAlso Not e.KeyValue = 38 Then Exit Sub
'Key Down/Up Code
End Sub
嗯,怎么样[结合的keydown听者](http://msdn.microsoft.com/en-us/library/system.windows.forms.control.keydown.aspx)? – 2011-04-06 23:41:19
可能的重复[如何知道箭头键是否被按下而未被释放?](http://stackoverflow.com/questions/4469939/how-do-i-know-if-a-arrow-key-was -pressed-and-not-released) – 2011-04-07 00:13:21
阅读本文 http://stackoverflow.com/questions/5589130/check-if-delete-key-is-pressed/7527570#7527570 – 2011-09-23 10:30:15