UDF > GDIPlus > GraphicsPath >


_GDIPlus_PathAddPath

Ajoute une figure à la figure actuelle

#include <GDIPlus.au3>
_GDIPlus_PathAddPath ( $hPath1, $hPath2 [, $bConnect = True] )

Paramètres

$hPath1 Handle de l'objet GraphicsPath
$hPath2 Handle de l'objet GraphicsPath à ajouter à $hPath1
$bConnect [optionnel] Valeur booléenne qui indique si la première figure du tracé ajouté appartient à la dernière figure du tracé actuel:
    True - La première figure du tracé ajouté $hPath2 fait partie de la dernière figure du tracé $hPath1
    False - La première figure du tracé ajouté $hPath2 est séparée de la dernière figure du tracé $hPath1

Valeur de retour

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

Remarque

Même si la valeur du paramètre $bCONNECT est True, cette fonction pourrait ne pas être en mesure de faire la première figure de $hPath2 partie de trajet supplémentaire de la dernière figure du tracé $hPath1.
Si l'une de ces figures est fermée, alors elles doivent rester des figures séparées.

Voir aussi

Consultez GdipAddPathPath 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