[mouse event]Capturing Mouse Position.avi

함흥처사 2014.05.31 07:09:28 *: Public Class Form1
Private Declare Function key Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Keys) As Keys
Dim Count As Integer = 0
Private Sub points()
Dim PosX As Integer = Form1.MousePosition.X
Dim PosY As Integer = Form1.MousePosition.Y
Dim Point = "X: " & PosX & " Y: " & PosY
If Count = 1 Then
Label1.Text = Point
ElseIf Count = 2 Then
Label2.Text = Point
ElseIf Count = 3 Then
Label3.Text = Point
ElseIf Count = 4 Then
Label4.Text = Point
End If
End Sub

Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
If key(Keys.LButton) Then
Count = Count + 1
points()
End If
If Count = 4 Then
Count = 0
End If
End Sub
End Class
동영상주소: http://www.youtube.com/watch?v=LX6y6_DVkn0