Zeichnet und füllt ein Polygon
#include <GDIPlus.au3>
_GDIPlus_GraphicsFillPolygon ( $hGraphics, $aPoints [, $hBrush = 0] )
$hGraphics | Handle zu einem Grafik-Objekt |
$aPoints | Array welches die Eckpunkte des Polygons festlegt: [0][0] - Anzahl von Eckpunkten [1][0] - Eckpunkt 1 X-Position [1][1] - Eckpunkt 1 Y-Position [2][0] - Eckpunkt 2 X-Position [2][1] - Eckpunkt 2 Y-Position [n][0] - Eckpunkt n X-Position [n][1] - Eckpunkt n Y-Position |
$hBrush | [optional] Handle zu einem Füllmuster-Objekt der verwendet wird um das Objekt zu füllen. |
Erfolg: | True |
Fehler: | False und setzt das @error Flag auf ungleich null, das @extended Flag kann den GPSTATUS-Fehlercode ($GPID_ERR* siehe GDIPlusConstants.au3) enthalten. |
Suche nach GdipFillPolygon in der MSDN Bibliothek.
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
Example()
Func Example()
Local $hWnd, $hGraphic, $aPoints[4][2]
; Erstellt eine GUI
$hGui = GUICreate("GDI+", 400, 300)
GUISetState(@SW_SHOW)
; Zeichne ein Polygon
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
$aPoints[0][0] = 3
$aPoints[1][0] = 150
$aPoints[1][1] = 150
$aPoints[2][0] = 200
$aPoints[2][1] = 100
$aPoints[3][0] = 250
$aPoints[3][1] = 150
MsgBox($MB_SYSTEMMODAL, "Information", "Fülle Polygon")
_GDIPlus_GraphicsFillPolygon($hGraphic, $aPoints)
; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Ressourcen freigeben
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
EndFunc ;==>Example
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Example()
Func Example()
_GDIPlus_Startup() ;initialize GDI+
Local Const $iWidth = 600, $iHeight = 600, $iBgColor = 0x303030 ;$iBGColor format RRGGBB
Local $hGUI = GUICreate("GDI+ Example (" & @ScriptName & ")", $iWidth, $iHeight) ;create a test GUI
GUISetBkColor($iBgColor, $hGUI) ;set GUI background color
GUISetState(@SW_SHOW)
Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;create a graphics object from a window handle
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;sets the graphics object rendering quality (antialiasing)
Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) ;color format AARRGGBB (hex)
; 1 _____ 3
; \ /
; \ /
; 2
Local $aPoints[4][2]
$aPoints[0][0] = 3
$aPoints[1][0] = 50.0
$aPoints[1][1] = 150.0
$aPoints[2][0] = 300.0
$aPoints[2][1] = 500.0
$aPoints[3][0] = 550.0
$aPoints[3][1] = 150.0
_GDIPlus_GraphicsFillPolygon($hGraphics, $aPoints, $hBrush) ;draw the triangle
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
;cleanup GDI+ resources
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
EndFunc ;==>Example