UDF > GDIPlus > StringFormat >


_GDIPlus_StringFormatSetAlign

Définit la justification du texte d'un objet StringFormat

#include <GDIPlus.au3>
_GDIPlus_StringFormatSetAlign ( $hStringFormat, $iFlag )

Paramètres

$hStringFormat Handle de l'objet StringFormat
$iFlag La justification peut être l'une des suivantes:
    0 - Le texte est justifié à gauche
    1 - Le texte est centré
    2 - Le texte est jstifié à droite

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

_GDIPlus_StringFormatCreate

Voir aussi

Consultez GdipSetStringFormatAlign dans la Librairie MSDN.

Exemple

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

Local $hWnd = GUICreate("GDI+ Example", 400, 300)
GUISetState(@SW_SHOW)

_GDIPlus_Startup()
Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
_GDIPlus_GraphicsClear($hGraphics)

Local $hBrush = _GDIPlus_BrushCreateSolid(0xFF009900)
Local $hFamily = _GDIPlus_FontFamilyCreate("Arial")
Local $hFont = _GDIPlus_FontCreate($hFamily, 36)
Local $hLayout = _GDIPlus_RectFCreate(0, 0, 400, 300)
Local $hStringFormat = _GDIPlus_StringFormatCreate()
_GDIPlus_StringFormatSetAlign($hStringFormat, 1)
_GDIPlus_GraphicsDrawStringEx($hGraphics, "AutoIt Rocks", $hFont, $hLayout, $hStringFormat, $hBrush)

Local $iMsg = 0
Do
    $iMsg = GUIGetMsg()
Until $iMsg = $GUI_EVENT_CLOSE

_GDIPlus_BrushDispose($hBrush)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_FontDispose($hFont)
_GDIPlus_StringFormatDispose($hStringFormat)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()