本文介绍了如何在vb.net中检测箭头键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用if语句在vb.net中检测箭头键?
How to detect arrow keys in vb.net using if statement?
推荐答案
Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
' Sets Handled to true to prevent other controls from
' receiving the key if an arrow key was pressed
Dim bHandled As Boolean = False
Select Case e.KeyCode
Case Keys.Right
'do stuff
e.Handled = True
Case Keys.Left
'do other stuff
e.Handled = True
Case Keys.Up
'do more stuff
e.Handled = True
Case Keys.Down
'do more stuff
e.Handled = True
End Select
End Sub
这篇关于如何在vb.net中检测箭头键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!