Cursor.Position
Panel.Cursor.Position
Dim PNTAPI As POINTAPI
Me.GetCursorPos(PNTAPI)
Me.Label1.Text = "X:" & PNTAPI.x.ToString & " " & "Y:" & PNTAPI.y.ToString
<StructLayout(LayoutKind.Sequential)> _
Private Structure POINTAPI
Public x As Int32
Public y As Int32
End Structure
Private Declare Function GetCursorPos Lib "user32.dll" (ByRef lpPoint As POINTAPI) As Int32
Dim pLocClient As Point = Nothing
Dim pLocScreen As Point = Nothing
pLocClient = Panel1.PointToClient(e.Location)
pLocScreen = Panel1.PointToScreen(e.Location)
Label1.Text = "Panel Coords: X: " & e.X.ToString & " Y: " & e.Y.ToString
Label2.Text = "Client Coords: X: " & pLocClient.X.ToString & " Y: " & pLocClient.Y.ToString
Label3.Text = "Screen Coords: X: " & pLocScreen.X.ToString & " Y: " & pLocScreen.Y.ToString