Funktionreferenz


_GDIPlus_GraphicsFillRect

Beschreibung anzeigen in

Füllt ein Rechteck

#include <GDIPlus.au3>
_GDIPlus_GraphicsFillRect ( $hGraphics, $nX, $nY, $nWidth, $nHeight [, $hBrush = 0] )

Parameter

$hGraphics Handle zu dem Grafik-Objekt
$nX Die X-Koordinate der oberen linken Ecke des Rechtecks
$nY Die Y-Koordinate der oberen linken Ecke des Rechtecks
$nWidth Die Breite des Rechtecks
$nHeight Die Höhe des Rechtecks
$hBrush [optional] Handle zu dem Füllmuster-Objekt, welches verwendet wird, um das Rechteck zu füllen. Falls 0, wird ein schwarzes Füllmuster verwendet.

Rückgabewert

Erfolg: True
Fehler: False und setzt das @error Flag auf ungleich null. @extended kann den GPSTATUS Fehlercode ($GPID_ERR* siehe GDIPlusConstants.au3) enthalten.

Siehe auch

Suche nach GdipFillRectangle in der MSDN Bibliothek.

Beispiel

Beispiel 1

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $hGui, $hGraphic

    ; Erstellt eine GUI
    $hGui = GUICreate("GDI+", 400, 300)
    GUISetState(@SW_SHOW)

    ; Zeichnet und füllt ein Rechteck
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
    _GDIPlus_GraphicsFillRect($hGraphic, 10, 10, 100, 100)

    ; 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

Beispiel 2

#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(0xFFEE88BB) ;color format AARRGGBB (hex)

    _GDIPlus_GraphicsFillRect($hGraphics, 150.5, 50.1, 280.25, 500.75, $hBrush)

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ;cleanup GDI+ resources
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    GUIDelete($hGUI)
EndFunc   ;==>Example