Setzt die Farbe des Zeichenstifts
#include <GDIPlus.au3>
_GDIPlus_PenSetColor ( $hPen, $iARGB )
$hPen | Handle zu dem Zeichenstift-Objekt |
$iARGB | Alpha, Rot, Grün und Blau Komponenten der Zeichenstiftfarbe |
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 GdipSetPenColor in der MSDN Bibliothek.
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
Example()
Func Example()
Local $hGUI = GUICreate("GDI+ test", 640, 480)
GUISetState(@SW_SHOW)
_GDIPlus_Startup()
Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Local $hPen = _GDIPlus_PenCreate(0xFF101010)
_GDIPlus_GraphicsDrawLine($hGraphics, 40, 40, 600, 440, $hPen) ;draw a test line to show smoothing effect (default no smoothing)
MsgBox($MB_SYSTEMMODAL, "", "Smoothing enabled: " & _GDIPlus_GraphicsGetSmoothingMode($hGraphics))
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;set smoothing mode (8 X 4 box filter)
_GDIPlus_PenSetColor($hPen, 0xFF000080)
_GDIPlus_GraphicsDrawLine($hGraphics, 600, 40, 40, 440, $hPen) ;draw a test line to show smoothing effect
MsgBox($MB_SYSTEMMODAL, "", "Smoothing enabled: " & _GDIPlus_GraphicsGetSmoothingMode($hGraphics))
If @OSBuild > 5999 Then
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) ;set smoothing mode (8 X 8 box filter)
_GDIPlus_GraphicsDrawEllipse($hGraphics, 220, 140, 200, 200, $hPen) ;draw a test line to show smoothing effect
MsgBox($MB_SYSTEMMODAL, "", "Smoothing enabled: " & _GDIPlus_GraphicsGetSmoothingMode($hGraphics))
EndIf
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
;cleanup resources
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
EndFunc ;==>Example
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
_Main()
Func _Main()
Local $hGUI, $hGraphic, $hPen
; Erstellt eine GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()
; Zeichnet eine Linie
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hPen = _GDIPlus_PenCreate()
;1. Kreis
ConsoleWrite("Stiftfarbe" & @TAB & _GDIPlus_PenGetColor($hPen) & @CRLF)
_GDIPlus_GraphicsDrawArc($hGraphic, 10, 10, 70, 70, 180, 360, $hPen)
;2. Kreis
_GDIPlus_PenSetColor($hPen, 0xFFFFFF00)
ConsoleWrite("Stiftfarbe" & @TAB & _GDIPlus_PenGetColor($hPen) & @CRLF)
_GDIPlus_GraphicsDrawArc($hGraphic, 200, 200, 70, 70, 180, 360, $hPen)
; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Ressourcen freigeben
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
EndFunc ;==>_Main