vb.net实现按字母控制button
答案:1 悬赏:40 手机版
解决时间 2021-02-19 07:45
- 提问者网友:谁的错
- 2021-02-18 20:03
vb.net实现按字母控制button
最佳答案
- 五星知识达人网友:七十二街
- 2021-02-18 21:35
如果是用键盘来代替鼠标点击按钮,用下面的代码
Public Class Form1
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Select Case Chr(e.KeyValue)
Case "A"
Button1_Click(sender, e)
Case ""
End Select
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.KeyPreview = True '窗体下注册键盘事件
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox("键盘A键按下")
End Sub
End Class
Public Class Form1
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Select Case Chr(e.KeyValue)
Case "A"
Button1_Click(sender, e)
Case ""
End Select
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.KeyPreview = True '窗体下注册键盘事件
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox("键盘A键按下")
End Sub
End Class
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯