UDF > GDIPlus > GraphicsPath >


_GDIPlus_PathAddRectangle

Ajoute un rectangle à une figure

#include <GDIPlus.au3>
_GDIPlus_PathAddRectangle ( $hPath, $nX, $nY, $nWidth, $nHeight )

Paramètres

$hPath Handle de l'objet GraphicsPath
$nX Coordonnée X du coin supérieur gauche du rectangle
$nY Coordonnée Y du coin supérieur gauche du rectangle
$nWidth Largeur du rectangle
$nHeight Hauteur du rectangle

Valeur de retour

Succès: Retourne True.
Échec: Retourne False et définit @error <> 0, @extended contient le code erreur ($GPID_ERR*).

Voir aussi

Consultez GdipAddPathRectangle dans la Librairie MSDN.

Exemple

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

Example()

Func Example()
    Local $hGUI, $hGraphic, $hBrush, $hPath1, $hPath2, $hMatrix

    ; Crée une GUI
    $hGUI = GUICreate("GDI+", 800, 200)
    GUISetState(@SW_SHOW)

    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ; Crée un objet graphique à partir du handle de la fenêtre
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ; Définit pour l'objet graphique la qualité de rendu antialiasing
    _GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)

    $hBrush = _GDIPlus_BrushCreateSolid(0xFFFF0000)

    $hPath1 = _GDIPlus_PathCreate() ; Crée un objet path
    For $i = 1 To 9
        _GDIPlus_PathAddRectangle($hPath1, 20 * $i, 10, 10, 180)
    Next

    $hPath2 = _GDIPlus_PathCreate() ; Crée un objet path
    For $i = 1 To 9
        _GDIPlus_PathAddRectangle($hPath2, 10, 20 * $i, 180, 10)
    Next

    _GDIPlus_GraphicsFillPath($hGraphic, $hPath1, $hBrush) ; Dessine path1 avec le handle Graphic (GUI)

    _GDIPlus_PathAddPath($hPath1, $hPath2) ; Ajoute path2 à path1

    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, 300, 0)
    _GDIPlus_PathTransform($hPath2, $hMatrix) ; Décale path2 de 300
    _GDIPlus_GraphicsFillPath($hGraphic, $hPath2, $hBrush) ; Dessine path2 avec le handle Graphic (GUI)

    _GDIPlus_MatrixTranslate($hMatrix, 300, 0)
    _GDIPlus_PathTransform($hPath1, $hMatrix) ; Décale path1 + path2 de 600
    _GDIPlus_GraphicsFillPath($hGraphic, $hPath1, $hBrush) ; Dessine path1 avec le handle Graphic (GUI)

    _GDIPlus_GraphicsDrawString($hGraphic, "+", 180, 10, "Arial Black", 100)
    _GDIPlus_GraphicsDrawString($hGraphic, "=", 480, 10, "Arial Black", 100)

    ; Boucle jusqu'à ce que l'utilisateur quitte.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Nettoie les ressources
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_PathDispose($hPath1)
    _GDIPlus_PathDispose($hPath2)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example