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