Einen wunderschönen guten Morgen,
hier ist mal wieder der Fragen-Michi auf der Suche nach dem Erklärbär
Heute habe ich eine Frage zu der Funktion _ChooseFont()
Eigentlich ist mir die Erklärung in der Hilfe ja klar nur bekomme ich es so nicht hin, die ausgewählte Schriftart auf eine Editbox anzuwenden.
Hier mal mein Code:
Spoiler anzeigen
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <Misc.au3>
#include <GuiEdit.au3>
#include <GuiRichEdit.au3>
_Main()
Func _Main()
;Hauptfenster erstellen
$Fenster = GUICreate("Fenster", 400, 300, -1, -1, $WS_OVERLAPPEDWINDOW)
GUISetBkColor(0xffffff)
;Notiz
$Textgruppe = GUICtrlCreateGroup(" Notiz ", 10, 10, 380, 280)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM)
GUICtrlSetFont(-1, 9, 400, 0, "Segoe UI Kursiv")
;Notiztitel
$Notiztitel = GUICtrlCreateInput("Neue Notiz", 20, 30, 360, 25)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKRIGHT)
GUICtrlSetFont(-1, 11, 400, 0, "Segoe UI Fett")
GUICtrlSetBkColor(-1, 0xffffc0)
;Notizentext
$Text = GUICtrlCreateEdit("Dies ist eine Test-Text um zu sehen ob sich die Schriftart ändern läßt.", 20, 60, 360, 190, $ES_MULTILINE + $ES_WANTRETURN + $ES_AUTOVSCROLL + $WS_VSCROLL)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM)
GUICtrlSetFont(-1, 9, 400, 0, "Segoe UI")
GUICtrlSetBkColor(-1, 0xffffc0)
GUICtrlSetCursor(-1, 5)
;Optionen-Button
$Btn_Optionen = GUICtrlCreateButton("Schriftart", 300, 260, 80, 25)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKBOTTOM + $GUI_DOCKRIGHT)
GUISetState(@SW_SHOW, $Fenster)
;---------------------------------------------------------------------------------------------------
;Hauptschleife im Hauptfenster
While 1
;Event-Meldungen abfangen
$msg = GUIGetMsg()
;Prüfen, was passiert ist
Select
;User hat den Beenden-Butten in einer Notiz gedrückt
Case $msg = $GUI_EVENT_CLOSE
GUIDelete($msg)
Exit
Case $msg = $Btn_Optionen
$a_font = _ChooseFont()
_SendMessage(GUICtrlGetHandle($Text), 0x0030, $a_font[2], True)
EndSelect
WEnd
EndFunc ;==>_Main
Er ändert zwar die Schriftart aber immer in die gleiche (Bin mir nicht sicher, welche das ist).
Wenn ich $a_font[2] ausgeben lasse, wird die richtige Schriftart angezeigt.
Wie geht es richtig?
Schön Dank schon mal für euer Interesse.
Michael