Function Reference


_GDIPlus_GraphicsDrawStringEx

Draw a string

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

Parameters

$hGraphics Handle to a Graphics object
$sString String to be drawn
$hFont Handle to the font to use to draw the string
$tLayout $tagGDIPRECTF structure that bounds the string
$hFormat Handle to the string format to draw the string
$hBrush Handle to the brush to draw the string

Return Value

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

Related

$tagGDIPRECTF, _GDIPlus_GraphicsDrawString

See Also

Search GdipDrawString in MSDN Library.

Example

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

Example()

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

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

    ; Draw a string
    _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)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Clean up resources
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example