#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPIEx.au3>
Global $nIDtmp
Global $Form1 = GUICreate("Form1", 365, 191, 192, 124)
Global $Label1 = GUICtrlCreateLabel("Кнопка 1", 32, 24, 140, 25, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetColor(-1, 0xFFFFFF)
Global $Label2 = GUICtrlCreateLabel("Кнопка 2", 32, 80, 140, 25, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState()
GUIRegisterMsg($WM_SETCURSOR, 'WM_SETCURSOR')
ConsoleWrite($Form1 & @LF)
Local $nMsg
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func WM_SETCURSOR($hWnd, $Msg, $wParam, $lParam)
#forceref $hWnd, $Msg, $lParam
Local $nID = _WinAPI_GetDlgCtrlID($wParam)
Local $getpos
If $nID > 0 Then $getpos = ControlGetPos($Form1, '', $nID)
Switch _WinAPI_HiWord($lParam)
Case 513
If $nID > 0 Then
Switch $nID
Case $Label1, $Label2
GUICtrlSetPos($nID, $getpos[0] + 2, $getpos[1] - 2, $getpos[2] - 2, $getpos[3] - 2)
$nIDtmp = $nID
EndSwitch
EndIf
Case 514
If $nID > 0 Then
Switch $nID
Case $Label1, $Label2
If $nIDtmp = $nID Then
GUICtrlSetPos($nID, $getpos[0] - 2, $getpos[1] + 2, $getpos[2] + 2, $getpos[3] + 2)
$nIDtmp = 0
EndIf
EndSwitch
EndIf
Case 512
If $nID = 0 Then
If $nIDtmp Then
$getpos = ControlGetPos($Form1, '', $nIDtmp)
GUICtrlSetPos($nIDtmp, $getpos[0] - 2, $getpos[1] + 2, $getpos[2] + 2, $getpos[3] + 2)
$nIDtmp = 0
EndIf
EndIf
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SETCURSOR