[mouse event]Capturing Mouse Position.avi
*
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

이 게시물을

댓글'2'
교교
  • 2014.06.03

VB에서는 대소문자 구분이 없이 함수명/변수명을 사용합니다만,
Win32 API에서는 대소문자의 구분이 분명합니다

이 댓글을

공유하기

SEARCH

MENU NAVIGATION