hallo Leutz,
habe auch mal ein wenig mit GDI+ gespielt, naja, oder eher Striche gezeichnet würde ich mal sagen
Soweit so gut, im folgenden Script habe ich mir aber dann die Frage gestellt, ist GDI+ wirklich so langsam ? oder gehts auch schneller ?
mal abgesehen davon das das Script einen Fehler beinhaltet. -> Es endet nicht wenn das quadrat fertig gezeichnet ist.
Spoiler anzeigen
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
[/autoit] [autoit][/autoit] [autoit]_Main()
[/autoit] [autoit][/autoit] [autoit]Func _Main()
Local $hGUI, $hWnd, $hGraphic, $hPenschwarz, $hPengruen, $hPenrot, $hPenblau, $closebutton, $hPen
Dim $posnull = 10 ; position null
Dim $abstand = 2 ; abstand
Dim $b = @DesktopHeight / 1.5 ; Größe des quadrates
Dim $c = $posnull, $d = $b
$hGUI = GUICreate("GDI+", $b + $posnull, $b + $posnull, -1, -1)
$closebutton = GUICtrlCreateButton("EXIT", @DesktopWidth - 70, 20, 50, 20)
GUICtrlSetState($closebutton, $GUI_DISABLE)
$hWnd = WinGetHandle("GDI+")
GUISetState()
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
$hPen = _GDIPlus_PenCreate(0xFF000000)
Do
_GDIPlus_GraphicsDrawLine($hGraphic, $posnull, $c, $c, $b, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, $c, $b, $b, $d, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, $b, $d, $d, $posnull, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, $d, $posnull, $posnull, $c, $hPen)
_GDIPlus_GraphicsDrawBezier($hGraphic, $posnull, $c, $b / 2, $b / 2, $b / 2, $b / 2, $c, $b, $hPen)
_GDIPlus_GraphicsDrawBezier($hGraphic, $c, $b, $b / 2, $b / 2, $b / 2, $b / 2, $b, $d, $hPen)
_GDIPlus_GraphicsDrawBezier($hGraphic, $b, $d, $b / 2, $b / 2, $b / 2, $b / 2, $d, $posnull, $hPen)
_GDIPlus_GraphicsDrawBezier($hGraphic, $d, $posnull, $b / 2, $b / 2, $b / 2, $b / 2, $posnull, $c, $hPen)
$c = $c + $abstand
$d = $d - $abstand
_GDIPlus_PenSetColor($hPen, '0xFF' & StringRight(Hex(Random(0, 16777215, 1)), 6))
Until $posnull = $b Or $posnull > $b
; Clean up resources
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_Main
wie gesagt, habe nur mal gespielt. Sinnlos wie das script auch sein mag
Gruß
Pre