UDF > GDIPlus > GraphicsPath >


_GDIPlus_PathAddLine2

Ajoute une séquence de lignes à la figure actuelle

#include <GDIPlus.au3>
_GDIPlus_PathAddLine2 ( $hPath, $aPoints )

Paramètres

$hPath Handle de l'objet GraphicsPath
$aPoints Tableau de points qui définit les lignes :
    [0][0] - Nombre de points
    [1][0] - Point 1, position X
    [1][1] - Point 1, position Y
    [2][0] - Point 2, position X
    [2][1] - Point 2, position Y
    [n][0] - Point n, position X
    [n][1] - Point n, position Y

Valeur de retour

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

En relation

_GDIPlus_PathAddLine

Voir aussi

Consultez GdipAddPathLine2 dans la Librairie MSDN.

Exemple

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

Example()

Func Example()
    Local $hGUI, $hGraphics, $hPath, $hCustomLineCap, $hClonedLineCap, $hPen
    Local $avPoints[4][2] = [[3],[-15, -15],[0, 0],[15, -15]]

    ; Initialisation GDI+
    _GDIPlus_Startup()

    ; Crée un objet Graphics à partir d'un handle fenêtre
    $hGUI = GUICreate("_GDIPlus_CustomLineCapCreate Example", 400, 200)
    GUISetState(@SW_SHOW)

    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)

    ; Définit pour l'objet graphique la qualité de rendu antialiasing
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY)

    ; Crée GraphicsPath et lui ajoute deux lignes.
    $hPath = _GDIPlus_PathCreate()
    _GDIPlus_PathAddLine2($hPath, $avPoints)

    ; Crée un objet CustomLineCap.
    $hCustomLineCap = _GDIPlus_CustomLineCapCreate(0, $hPath)

    ; Crée un objet clone de CustomLineCap.
    $hClonedLineCap = _GDIPlus_CustomLineCapClone($hCustomLineCap)

    ; Crée un objet Pen, attribue l'embout cloné comme embout personnalisé, et trace une ligne.
    $hPen = _GDIPlus_PenCreate(0xFFFF0000)
    _GDIPlus_PenSetCustomEndCap($hPen, $hClonedLineCap)

    _GDIPlus_GraphicsDrawLine($hGraphics, 50, 50, 350, 150, $hPen)

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Nettoie
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_CustomLineCapDispose($hClonedLineCap)
    _GDIPlus_CustomLineCapDispose($hCustomLineCap)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_GraphicsDispose($hGraphics)

    ; Arrête GDI+
    _GDIPlus_Shutdown()
EndFunc   ;==>Example