-
Hihi! I'm working on my awesome map editor for my RPG :D And I'm using GetCursorPos to select the tile that I want to change/edit walkability on. All is well, except I need to know one thing: How do I make the GetCursorPos API have the 0,0 coordinate start at the top left of the picturebox, rather than the top left of the screen?
-
......very easy
add:
-picture1
-timer1
to the project
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Sub Timer1_Timer()
Dim pt As POINTAPI
GetCursorPos pt
' Translate into window coordinates.
ScreenToClient Picture1.hwnd, pt
Debug.Print pt.X, pt.Y
End Sub
-