UDF > GDIPlus > Text >


_GDIPlus_GraphicsDrawStringEx

Dessine une chaîne

#include <GDIPlus.au3>
_GDIPlus_GraphicsDrawStringEx ( $hGraphics, $sString, $hFont, $tLayout, $hFormat, $hBrush )

Paramètres

$hGraphics Handle de l'objet Graphics
$sString Chaîne à dessiner
$hFont Handle de la police à utiliser pour dessiner la chaîne
$tLayout Structure $tagGDIPRECTF qui délimite la chaîne
$hFormat Handle du format de chaîne pour dessiner la chaîne
$hBrush Handle du pinceau pour dessiner la chaîne

Valeur de retour

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

En relation

$tagGDIPRECTF, _GDIPlus_GraphicsDrawString

Voir aussi

Consultez GdipDrawString dans la Librairie MSDN.

Exemple

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

Example()

Func Example()
    Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout
    Local $sString = "Hello world", $aInfo

    ; Crée GUI
    $hGUI = GUICreate("GDI+", 400, 300)
    GUISetState(@SW_SHOW)

    ; Dessine une chaîne
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBrush = _GDIPlus_BrushCreateSolid(0xFF00007F)
    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    $hFont = _GDIPlus_FontCreate($hFamily, 12, 2)
    $tLayout = _GDIPlus_RectFCreate(140, 110, 0, 0)
    $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat)
    _GDIPlus_GraphicsDrawStringEx($hGraphic, $sString, $hFont, $aInfo[0], $hFormat, $hBrush)

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

    ; Nettoie les ressources
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example