UDF > GDIPlus > GraphicsPath >


_GDIPlus_PathAddString

Ajoute le contour d'une chaîne à une figure

#include <GDIPlus.au3>
_GDIPlus_PathAddString ( $hPath, $sString, $tLayout, $hFamily [, $iStyle = 0 [, $fSize = 8.5 [, $hFormat = 0]]] )

Paramètres

$hPath Handle de l'objet GraphicsPath
$sString Chaîne à dessiner
$tLayout Structure $tagGDIPRECTF qui délimite la chaîne
$hFamily Handle de l'objet FontFamily qui spécifie la famille de la police pour la chaîne
$iStyle [optionnel] Le style de la police. Peut être une combinaison des éléments suivants :
    0 - Graisse ou épaisseur normale des caractères
    1 - Gras
    2 - Italique
    4 - Souligné
    8 - Barré
$fSize [optionnel] La taille 'em', en unité universelle, des caractères de la chaîne
$hFormat [optionnel] Handle de l'objet StringFormat qui spécifie des informations de mise en page pour la chaîne

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 GdipAddPathString dans la Librairie MSDN.

Exemple

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

Example()

Func Example()
    Local $hGUI, $hGraphic, $hBrush, $hPen, $hPath, $hFamily, $tLayout

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

    ; Dessine une chaîne en utilisant un Path
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ; Crée un objet graphique à partir du handle de la fenêtre
    $hBrush = _GDIPlus_BrushCreateSolid(0xFFDD2200)
    $hPen = _GDIPlus_PenCreate(0xFFFFBB00, 2)

    $hPath = _GDIPlus_PathCreate() ; Crée un objet path

    $hFamily = _GDIPlus_FontFamilyCreate("Arial") ; Crée un objet FontFamily
    $tLayout = _GDIPlus_RectFCreate() ; Crée une chaîne délémitée par un rectangle de coin X=0, Y=0
    _GDIPlus_PathAddString($hPath, "AutoIt rulez!", $tLayout, $hFamily, 0, 72, 0) ; Ajoute le contour de la chaîne au Path

    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ; Définit pour l'objet graphique la qualité de rendu antialiasing
    _GDIPlus_GraphicsClear($hGraphic, 0xFF000000)
    _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ; Dessine le Path avec le handle Graphic (GUI)
    _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ; Dessine le Path avec le handle Graphic (GUI)

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

    ; Nettoie les ressources
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example