UDF > GDIPlus > CustomLineCap >


_GDIPlus_CustomLineCapClone

Duplique un embout personnalisé de ligne (CustomLineCap)

#include <GDIPlus.au3>
_GDIPlus_CustomLineCapClone ( $hCustomLineCap )

Paramètre

$hCustomLineCap Handle de l'objet CustomLineCap

Valeur de retour

Succès: Retourne le handle de l'objet CustomLineCap cloné.
Échec: Retourne 0 et définit @error <> 0, @extended contient le code erreur GPSTATUS ($GPID_ERR*).

Remarque

Lorsque vous en avez terminé avec l'objet CustomLineCap, appelez _GDIPlus_CustomLineCapDispose() pour libérer les ressources.

En relation

_GDIPlus_CustomLineCapDispose

Voir aussi

Cherchez GdipCloneCustomLineCap dans la Library 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