#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
GUISetBkColor(0xB4B4B4)
;$Pic1 = GUICtrlCreatePic("", 0, 0, 25, 25)
$Pic2 = GUICtrlCreatePic(@ScriptDir & "\black.jpg", 555, 0, 60, 60)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
AdlibRegister("_gui", 1000)
$once = 0
Global $pic[11] = [], $x[11] = [], $y[11] = []
While 1
$nMsg = GUIGetMsg()
Switch $nmsg
Case -7
$mouse = GUIGetCursorInfo($Form1)
If $mouse[4] And $mouse[4] <> $Pic2 Then
$PC = ControlGetPos($Form1, '', $mouse[4])
$XD = $mouse[0] - $PC[0]
$YD = $mouse[1] - $PC[1]
While 1
$msg1 = GUIGetMsg()
Switch $msg1
Case -11
$mouse1 = GUIGetCursorInfo($Form1)
$result1 = $mouse1[0] - $XD
$result2 = $mouse1[1] - $YD
$mouse1 = GUIGetCursorInfo($Form1)
GUICtrlSetPos($mouse[4], $result1, $result2, $PC[2], $PC[3])
If $mouse[4] And $mouse1[4] <> $Pic2 Then
If $result1 > 555 And $result2 < 60 Then GUICtrlDelete($mouse[4])
EndIf
Case -8
ExitLoop
Case -3
Exit
EndSwitch
WEnd
EndIf
Case -3
Exit
EndSwitch
WEnd
Func cursor()
$mouse = GUIGetCursorInfo($Form1)
If $mouse[2] = 1 Then
GUICtrlSetPos($mouse[4],$mouse[0] - 12,$mouse[1] - 12,25,25)
EndIf
EndFunc
Func _gui()
If $once = 0 Then
For $i = 0 To 10 Step +1
$x[$i] = Random(0,530,1)
$y[$i] = Random(0,410,1)
$Pic[$i] = GUICtrlCreatePic(@ScriptDir & "\test.jpg", $x, $y, 25, 25)
$once = 1
ConsoleWrite($i)
Next
EndIf
For $i = 0 To 10 Step +1
$mouse = GUIGetCursorInfo($Form1)
If $mouse[4] <> $Pic[$i] Then
If @error Then ToolTip("Ошибка")
$RanX = Random(1,10,0)
$RanY = Random(1,10,0)
If $RanX + $x[$i] > 530 Then $Ran = -10
If $RanY + $x[$i] > 410 Then $Ran = -10
GUICtrlSetPos($Pic[$i], $x[$i] + $RanX, $y[$i] + $RanY, 25, 25)
EndIf
Next
EndFunc