Function Reference


_GDIPlus_PathAddString

Adds the outline of a string to a path

#include <GDIPlus.au3>
_GDIPlus_PathAddString ( $hPath, $sString, $tLayout, $hFamily [, $iStyle = 0 [, $fSize = 8.5 [, $hFormat = 0]]] )

Parameters

$hPath Pointer to a GraphicsPath object
$sString String to be drawn
$tLayout $tagGDIPRECTF structure that bounds the string
$hFamily Pointer to a FontFamily object that specifies the font family for the string
$iStyle [optional] The style of the typeface. Can be a combination of the following:
    0 - Normal weight or thickness of the typeface
    1 - Bold typeface
    2 - Italic typeface
    4 - Underline
    8 - Strikethrough
$fSize [optional] The em size, in world units, of the string characters
$hFormat [optional] Pointer to a StringFormat object that specifies layout information for the string

Return Value

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

See Also

Search GdipAddPathString in MSDN Library.

Example

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

Example()

Func Example()
    Local $hGUI, $hGraphic, $hBrush, $hPen, $hPath, $hFamily, $tLayout

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

    ; Draw a string using path
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;Create a graphics object from a window handle
    $hBrush = _GDIPlus_BrushCreateSolid(0xFFDD2200)
    $hPen = _GDIPlus_PenCreate(0xFFFFBB00, 2)

    $hPath = _GDIPlus_PathCreate() ;Create new path object

    $hFamily = _GDIPlus_FontFamilyCreate("Arial") ;Create font family object
    $tLayout = _GDIPlus_RectFCreate() ;Create string bounding rectangle X=0, Y=0
    _GDIPlus_PathAddString($hPath, "AutoIt rulez!", $tLayout, $hFamily, 0, 72, 0) ;Add the outline of the string to the path

    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;Sets the graphics object rendering quality (antialiasing)
    _GDIPlus_GraphicsClear($hGraphic, 0xFF000000)
    _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ;Fill path to graphics handle (GUI)
    _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ;Draw path to graphics handle (GUI)

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

    ; Clean up resources
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example