Function Reference


_GDIPlus_StringFormatSetAlign

Sets the text alignment of a string format object

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

Parameters

$hStringFormat The string format object which is aligned
$iFlag The alignment can be one of the following:
    0 - The text is aligned to the left
    1 - The text is centered
    2 - The text is aligned to the right

Return Value

Success: True.
Failure: False and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPIP_ERR* see GPIPlusConstants.au3).

Related

_GDIPlus_StringFormatCreate

See Also

Search GdipSetStringFormatAlign in MSDN Library.

Example

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

Local $hWnd = GUICreate("GDI+ Example (" & @ScriptName & ")", 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()