Function Reference


Sets the line alignment of a StringFormat object in relation to the origin of a layout rectangle

#include <GDIPlus.au3>
_GDIPlus_StringFormatSetLineAlign ( $hStringFormat, $iStringAlign )


$hStringFormat Pointer to a StringFormat object
$iStringAlign Type of line alignment to use:
    0 - Alignment is towards the origin of the bounding rectangle
    1 - Alignment is centered between origin and the height of the formatting rectangle
    2 - Alignment is to the far extent (right side) of the formatting rectangle

Return Value

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


The line alignment setting specifies how to align the string vertically in the layout rectangle.
The layout rectangle is used to position the displayed string.



See Also

Search GdipSetStringFormatLineAlign in MSDN Library.


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


Func Example()
    Local $hWnd = GUICreate("GDI+ Example (" & @ScriptName & ")", 400, 300)

    Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)

    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_StringFormatSetLineAlign($hStringFormat, 1)
    _GDIPlus_GraphicsDrawStringEx($hGraphics, "AutoIt Rocks", $hFont, $hLayout, $hStringFormat, $hBrush)

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

EndFunc   ;==>Example