Public Class Form1
'دالة من دوال API لتغير مكان الماوس
<System.Runtime.InteropServices.DllImportAttribute("user32.dll", EntryPoint:="SetCursorPos")> _
Public Shared Function SetCursorPos(ByVal X As Integer, ByVal Y As Integer) As <System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)> Boolean
End Function
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'هذه نقطة منتصف الزر وهذه النقطة بالنسبة للفورم
Dim P As New Point(Button1.Location.X + Button1.Width / 2, Button1.Location.Y + Button1.Height / 2)
'قمنا بجلب نقطة منتصف الزر ولكن بانسبة للشاشة كلها
SetCursorPos(PointToScreen(P).X, PointToScreen(P).Y)
End Sub
End Class