Es gibt zwar höchstwahrscheinlich viel einfachere Wege, aber das ist das
einzigste was mir eingefallen ist. Ich habe zwar eine UDF gefunden die die
Mouse Events abfängt aber das lastet bei deinen Anforderungen stark das
System aus.
Um das Script zu testen musst du halt ein Bild test.jpg in das Verzeichnis ziehen,
dann sollte das alles klappen.
Falls du da nicht durchsiehst schreib am besten was dann erkläre ich alles
morgen.
(Ich habe ein paar Stunden an der optimalen Lösung gesessen und hatte zum
Schluss keine Lust mehr alles ordentlich zu schreiben. Wunder dich nicht wenn
das alles etwas chaotisch und teilweise unlogisch ist sein kann)
Code:
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
$main = GUICreate("test",500,500)
$pic = GUICtrlCreatePic("test.jpg",0,0,200,200)
$gui_trans = GUICreate("",200,200,10,10,$WS_POPUP,$WS_EX_MDICHILD,$main)
GUISetBkColor(0x0000FF)
WinSetTrans($gui_trans,"",1)
GUISetState(@SW_SHOW,$main)
GUISetState(@SW_SHOW,$gui_trans)
WinActivate($main)
GUIRegisterMsg(0x0201,"_ldown")
While 1
GUISwitch($main)
$msg = GUIGetMsg()
If $msg = -3 Then
Exit
EndIf
Sleep(50)
WEnd
Func _ldown()
If WinActive($gui_trans) Then
WinSetTrans($gui_trans,"",50)
$pos_bkp = MouseGetPos()
Do
$pos_mouse = MouseGetPos()
If $pos_bkp[0] = $pos_mouse[0] And $pos_bkp[1] = $pos_mouse[1] Then
Else
$pos_tr = WinGetPos($gui_trans)
$pos_main = WinGetPos($main)
ControlMove($main,"",$pic,($pos_mouse[0] - $pos_main[0] ) - 3 - ($pos_mouse[0] - $pos_tr[0]), ($pos_mouse[1] - $pos_main[1]) - 22 - ($pos_mouse[1] - $pos_tr[1]))
WinMove($gui_trans,"", $pos_tr[0] - ($pos_bkp[0] - $pos_mouse[0]), $pos_tr[1] - ($pos_bkp[1] - $pos_mouse[1]))
$pos_bkp = $pos_mouse
EndIf
Sleep(20)
Until GUIGetMsg() = $GUI_EVENT_PRIMARYUP
WinSetTrans($gui_trans,"",1)
EndIf
EndFunc