Hi,
tröste dich, es hat auch bei mir ein bisschen gedauert, bis ich meine Sätze wieder zusammen hatte ;).
Spoiler anzeigen
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
Global $a, $b, $bufferarray[2], $x = 193, $y = 125
[/autoit] [autoit][/autoit] [autoit]$hWnd = GUICreate("Form1", 105, 105, $x, $y, $WS_POPUP)
GUISetState(@SW_SHOW)
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
$Pen1 = _GDIPlus_PenCreate(0xFF0000FF, 5)
$Pen2 = _GDIPlus_PenCreate(0xFFFF0000, 5)
_GDIPlus_GraphicsDrawArc($hGraphic, 2, 2, 100, 100, 0, 360, $Pen1)
_GDIPlus_GraphicsDrawArc($hGraphic, 2, 2, 100, 100, 90, 90, $Pen2)
While 1
$pos = MouseGetPos()
If ($pos[0] <> $bufferarray[0]) And ($pos[1] <> $bufferarray[1]) Then
$a = ($y + 50) - $pos[1]
$b = ($x + 50) - $pos[0]
$winkel = 180 - (90 + _Atan($b / $a))
If $a > 0 Then $winkel = $winkel + 180
_redraw($winkel - 45)
$bufferarray[0] = $pos[0]
$bufferarray[1] = $pos[1]
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case - 3
Exit
EndSwitch
WEnd
Func _redraw($pos)
_GDIPlus_GraphicsDrawArc($hGraphic, 2, 2, 100, 100, 0, 360, $Pen1)
_GDIPlus_GraphicsDrawArc($hGraphic, 2, 2, 100, 100, $pos, 90, $Pen2)
EndFunc ;==>_redraw
Func _Atan($num)
$radToDeg = 180 / (4 * ATan(1))
Return ATan($num) * $radToDeg
EndFunc ;==>_Atan
/Edit: kleiner Fix