Erstellt ein String-Format-Objekt
#include <GDIPlus.au3>
_GDIPlus_StringFormatCreate ( [$iFormat = 0 [, $iLangID = 0]] )
$iFormat | [optional] Format Flags. Können ein oder mehrere der folgenden sein: 0x0001 - Gibt an, dass die Reihenfolge des Lesens von rechts nach links ist. 0x0002 - Legt fest, dass einzelne Textzeilen vertikal auf das Display gezeichnet werden. 0x0004 - Gibt an, dass Teile von Zeichen erlaubt sind um das Rechteck-Layout des strings zu überragen 0x0020 - Gibt an, dass das Unicode-Layout Kontrollelement mit einem vertretenden Zeichen angezeigt wird. 0x0400 - Gibt an, dass für Zeichen, die in der gewünschten Schriftart nicht unterstützt werden eine alternative Schriftart benutzt wird. 0x0800 - Gibt an, dass die Leerzeichen am Ende jeder Zeile in einen String-Messwert eingebunden werden. 0x1000 - Gibt an, dass der Umbruch des Textes auf die nächste Zeile deaktiviert ist. 0x2000 - Gibt an, dass nur ganze Zeilen in das Layout-Rechteck gelegt werden 0x4000 - Gibt an, dass Zeichen die das Layout-Rechteck überragen und Text der über das Ende des Layout-Rechtecks hinausschaut angezeigt werden darf. |
$iLangID | [optional] Die Sprache die benutzt werden soll. |
Erfolg: | ein Handle auf ein String-Format-Objekt |
Fehler: | 0 und setzt das @error Flag auf ungleich null. @extended kann den GPSTATUS Fehlercode ($GPID_ERR* siehe GDIPlusConstants.au3) enthalten. |
Wenn man fertig ist mit dem String-Format, sollte man zur Freigabe der Ressourcen _GDIPlus_StringFormatDispose() aufrufen.
_GDIPlus_StringFormatDispose, _GDIPlus_StringFormatSetAlign
Suche nach GdipCreateStringFormat in der MSDN Bibliothek.
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Example()
Func Example()
Local $hGui, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout
; 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, 100, 20)
_GDIPlus_GraphicsDrawStringEx($hGraphic, "Hallo Welt!", $hFont, $tLayout, $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