ITPub博客

首页 > 数字化转型 > ERP > 获取鼠标和键盘信息的方法

获取鼠标和键盘信息的方法

原创 ERP 作者:tntzwc 时间:2007-08-24 17:47:47 0 删除 编辑

Public Class Form1
Public loop1 As Boolean = True
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim pMousePos As Point
While loop1
System.Windows.Forms.Application.DoEvents()
pMousePos = Control.MousePosition
Select Case Control.MouseButtons
Case Windows.Forms.MouseButtons.Left
MessageBox.Show("Mouse_Left(" & pMousePos.X.ToString & "," & pMousePos.Y.ToString & ")")
Case Windows.Forms.MouseButtons.Middle
MessageBox.Show("Mouse_Middle(" & pMousePos.X.ToString & "," & pMousePos.Y.ToString & ")")
Case Windows.Forms.MouseButtons.None
'MessageBox.Show("None")
Case Windows.Forms.MouseButtons.Right
MessageBox.Show("Mouse_Right(" & pMousePos.X.ToString & "," & pMousePos.Y.ToString & ")")
End Select
End While

End Sub

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Escape Then
loop1 = False
End If
End Sub
End Class

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10606164/viewspace-965612/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 我要买书
下一篇: 没有了~
请登录后发表评论 登录
全部评论
  • 博文量
    7
  • 访问量
    3578