Legt die Schrifteigenschaften des markierten Textes oder, wenn nichts markiert worden ist, des eingefügten Textes ab dem Einfügepunkt fest
#include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetFont ( $hWnd [, $iPoints = Default [, $sName = Default [, $iCharset = Default [, $iLcid = Default]]]] )
$hWnd | Handle des Controls |
$iPoints | [optional] Größe in Punkten (pt) |
$sName | [optional] Name des Schriftbildes, z.B. "Courier" aber nicht "Courier Bold" |
$iCharSet | [optional] Der Zeichensatz: $ANSI_CHARSET - 0 $BALTIC_CHARSET - 186 $CHINESEBIG5_CHARSET - 136 $DEFAULT_CHARSET - 1 $EASTEUROPE_CHARSET - 238 $GB2312_CHARSET - 134 $GREEK_CHARSET - 161 $HANGEUL_CHARSET - 129 $HEBREW_CHARSET - 177 $JOHAB_CHARSET - 130 $MAC_CHARSET - 77 $OEM_CHARSET - 255 $RUSSIAN_CHARSET - 204 $SHIFTJIS_CHARSET - 128 $SYMBOL_CHARSET - 2 $THAI_CHARSET - 222 $TURKISH_CHARSET - 162 $VIETNAMESE_CHARSET - 163 Konstanten sind in FontConstants.au3 definiert. |
$iLcid | [optional] siehe http://www.microsoft.com/globaldev/reference/lcid-all.mspx |
Erfolg: | True |
Fehler: | False und setzt das @error Flag auf ungleich null |
@error: | 101 - $hWnd ist kein Handle 102 - $iPoints ist keine positive Zahl 103 - $sName ist nicht alphabetisch 104 - $iCharSet ist keine Nummer 105 - $iLcid ist keine Nummer |
Wird ein Parameter weggelassen (oder ist Default), ist der Wert unverändert
- - - - - - - - Erklärung der Controls - - - - - - - -
_GUICtrlRichEdit_ChangeFontSize, _GUICtrlRichEdit_GetFont
Suche nach EM_SETCHARFORMAT in der MSDN Bibliothek. Suche nach LOGFONT in der MSDN Bibliothek.
#include <GUIConstantsEx.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>
Global $g_idLblMsg, $g_hRichEdit
Example()
Func Example()
Local $hGui, $iMsg, $idBtnNext, $iStep = 0
$hGui = GUICreate("Beispiel (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1)
$g_hRichEdit = _GUICtrlRichEdit_Create($hGui, "Dies ist ein Test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$g_idLblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$idBtnNext = GUICtrlCreateButton("Weiter", 270, 310, 40, 30)
GUISetState(@SW_SHOW)
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
_GUICtrlRichEdit_Destroy($g_hRichEdit) ; wird benötigt, da sonst das Skript abstürzt
;~ GUIDelete() ; ist auch in Ordnung
Exit
Case $iMsg = $idBtnNext
$iStep += 1
Switch $iStep
Case 1
Report("1. Start Einstellung")
Case 2
_GUICtrlRichEdit_SetFont($g_hRichEdit, 15, "Times Roman")
Report("2. Setzt die Schriftart")
GUICtrlSetState($idBtnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Example
Func Report($sMsg)
Local $aRet = _GUICtrlRichEdit_GetFont($g_hRichEdit)
$sMsg = $sMsg & @CR & @CR & $aRet[1] & " " & $aRet[0] & " Punkte"
GUICtrlSetData($g_idLblMsg, $sMsg)
EndFunc ;==>Report