Funktionreferenz


_GDIPlus_GraphicsDrawStringEx

Beschreibung anzeigen in

Zeichnet einen String

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

Parameter

$hGraphics Handle zu dem Grafik-Objekt
$sString zu zeichnender String
$hFont Handle zu der Schrift, welche verwendet werden soll um den String zu zeichnen
$tLayout $tagGDIPRECTF Struktur welche den String eingrenzt
$hFormat Handle zu dem Stringformat um den String zu zeichnen
$hBrush Handle zu dem Füllmuster um den String zu zeichnen

Rückgabewert

Erfolg: True
Fehler: False und setzt das @error Flag auf ungleich null. @extended kann den GPSTATUS Fehlercode ($GPID_ERR* siehe GDIPlusConstants.au3) enthalten.

Verwandte Funktionen

$tagGDIPRECTF, _GDIPlus_GraphicsDrawString

Siehe auch

Suche nach GdipDrawString in der MSDN Bibliothek.

Beispiel

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

Example()

Func Example()
    Local $hGui, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout
    Local $sString = "Hallo Welt", $aInfo

    ; Erstellt eine GUI
    $hGui = GUICreate("GDI+", 400, 300)
    GUISetState(@SW_SHOW)

    ; Zeichnet einen 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)

    ; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Ressourcen freigeben
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example