GUICtrlSetFont

  • Also ich habe mal einen Editor gemacht kann man mit autoit eine Combo anlegen bei der bei 10 die Schriftgröße auf 10 gestellt wird und bei 12 die Schriftgröse auf 12 gestellt wird ich hoffe mir kann hierbei jemand helfen

    mfg. Simon

  • [autoit]

    #include <GUIConstants.au3>

    [/autoit][autoit][/autoit][autoit]

    GUICreate("Meine GUI-combo") ; erstellt ein GUI-Fenster welches mittig ausgerichtet wird

    [/autoit][autoit][/autoit][autoit]

    GUICtrlCreateCombo ("Element1", 10,10) ; erstellt das erste Element
    GUICtrlSetData(-1,"Element2|Element3","Element3") ; fügt andere Elemente hinzu und setzt "Element3" als neuen vorausgewählten Wert der Listbox

    [/autoit][autoit][/autoit][autoit]

    GUISetState ()

    [/autoit][autoit][/autoit][autoit]

    ; die GUI läuft bis sie geschlossen wird
    While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Wend

    [/autoit]

    kleine hilfe mehr verrat ich nicht den ret bekommst du in der hilfe raus

  • Dies habe ich schnell gemacht als Test für meine nächste Version

    Dies ist der Quellcode:

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    AutoIt Version: 3.2.12.1
    Author: Simon

    [/autoit] [autoit][/autoit] [autoit]

    Script Function:TextEditor
    Template AutoIt script.

    [/autoit] [autoit][/autoit] [autoit]

    #ce ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; Script Start - Add your code below here

    [/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstantsEX.au3>

    [/autoit] [autoit][/autoit] [autoit]

    GUICreate("Word",300,300)
    GUISetBkColor(0xCDAD00)
    GUICtrlCreateEdit("",10,50,200,200)
    GUICtrlCreateCombo("10",10,10)
    GUICtrlSetDAta(-1,"12|14|16|18")
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd

    [/autoit]

    kann man auch die maximier funktion in einer gui aktivieren

  • schau in die hilfe da steht alles drin

    nicht ganz correct du must die combo ja noch mit funktionen versehen

  • Ich meine ja nicht mit GUICtrlSetFont(-1,10,400) sonder mit der Combo dies zur regeln für den user also nicht voreinstellen

  • aus der hilfe:

    Spoiler anzeigen
    [autoit]

    #AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
    #include <GUIComboBox.au3>
    #include <GuiConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Constants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt('MustDeclareVars', 1)

    [/autoit] [autoit][/autoit] [autoit]

    $Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

    [/autoit] [autoit][/autoit] [autoit]

    Global $hCombo

    [/autoit] [autoit][/autoit] [autoit]

    _Main()

    [/autoit] [autoit][/autoit] [autoit]

    Func _Main()
    Local $hGUI

    [/autoit] [autoit][/autoit] [autoit]

    ; Create GUI
    $hGUI = GUICreate("(UDF) ComboBox Create", 400, 296)
    $hCombo = _GUICtrlComboBox_Create($hGUI, "", 2, 2, 396, 296)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    ; Add files
    _GUICtrlComboBox_BeginUpdate($hCombo)
    _GUICtrlComboBox_AddDir($hCombo, "", $DDL_DRIVES, False)
    _GUICtrlComboBox_EndUpdate($hCombo)

    [/autoit] [autoit][/autoit] [autoit]

    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

    [/autoit] [autoit][/autoit] [autoit]

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
    EndFunc ;==>_Main

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
    $iCode = BitShift($iwParam, 16) ; Hi Word
    Switch $hWndFrom
    Case $hCombo
    Switch $iCode
    Case $CBN_CLOSEUP ; Sent when the list box of a combo box has been closed
    _DebugPrint("$CBN_CLOSEUP" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_DBLCLK ; Sent when the user double-clicks a string in the list box of a combo box
    _DebugPrint("$CBN_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_DROPDOWN ; Sent when the list box of a combo box is about to be made visible
    _DebugPrint("$CBN_DROPDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_EDITCHANGE ; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box
    _DebugPrint("$CBN_EDITCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_EDITUPDATE ; Sent when the edit control portion of a combo box is about to display altered text
    _DebugPrint("$CBN_EDITUPDATE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_ERRSPACE ; Sent when a combo box cannot allocate enough memory to meet a specific request
    _DebugPrint("$CBN_ERRSPACE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_KILLFOCUS ; Sent when a combo box loses the keyboard focus
    _DebugPrint("$CBN_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box
    _DebugPrint("$CBN_SELCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_SELENDCANCEL ; Sent when the user selects an item, but then selects another control or closes the dialog box
    _DebugPrint("$CBN_SELENDCANCEL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_SELENDOK ; Sent when the user selects a list item, or selects an item and then closes the list
    _DebugPrint("$CBN_SELENDOK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_SETFOCUS ; Sent when a combo box receives the keyboard focus
    _DebugPrint("$CBN_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_COMMAND

    [/autoit] [autoit][/autoit] [autoit]

    Func _DebugPrint($s_text, $line = @ScriptLineNumber)
    ConsoleWrite( _
    "!===========================================================" & @LF & _
    "+======================================================" & @LF & _
    "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
    "+======================================================" & @LF)
    EndFunc ;==>_DebugPrint

    [/autoit]
  • So, ist eine Möglichkeit ...

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEX.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $hwnd = GUICreate("Word",300,300)
    GUISetBkColor(0xCDAD00)
    $IDC_EDIT = GUICtrlCreateEdit("Text",10,50,200,200)
    $IDC_COMBO = GUICtrlCreateCombo("10",10,10, 40)
    GUICtrlSetDAta(-1,"12|14|16|18")
    GUISetState(@SW_SHOW, $hwnd)

    [/autoit] [autoit][/autoit] [autoit]

    While 1

    Switch GUIGetMsg()

    Case $IDC_COMBO
    GUICtrlSetFont ($IDC_EDIT, GUICtrlRead ($IDC_COMBO))

    Case $GUI_EVENT_CLOSE
    ExitLoop
    EndSwitch

    WEnd

    [/autoit]


    LG
    Greenhorn


  • Danke !!!
    kann man das auch für extra wörter machen also das man verschiedenen Wörtern eine andere Schriftgröße geben kan

  • ich hab noch ne frage ich habe jetzt dies gemacht

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEX.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $hwnd = GUICreate("Word",300,300)
    GUISetBkColor(0xCDAD00)
    $IDC_EDIT = GUICtrlCreateEdit("Text",10,50,200,200)
    $IDC_COMBO = GUICtrlCreateCombo("10",10,10, 40)
    GUICtrlSetDAta(-1,"12|14|16|18")
    $kursiv = GUICtrlCreateCombo("2",60,10,70)
    GUICtrlSEtData(-1,"4")
    GUISetState(@SW_SHOW, $hwnd)

    [/autoit] [autoit][/autoit] [autoit]

    While 1

    Switch GUIGetMsg()

    Case $IDC_COMBO
    GUICtrlSetFont ($IDC_EDIT, GUICtrlRead ($IDC_COMBO),400,GUICtrlRead($kursiv))

    Case $GUI_EVENT_CLOSE
    ExitLoop
    EndSwitch

    WEnd

    [/autoit]

    wie kann ich hier bei 2 und 4 in der combo kursiv und unterstrichen hinschreiben und es geht trotzdem

  • Erzeuge noch eine ComboBox mit kursiv, unterstrichen ... ;)

    EDIT:
    Sorry, gepennt ... :rolleyes:
    Erzeuge eine Funktion, die das für dich macht ...

    [autoit]

    func SetFontAttribute ( )

    [/autoit][autoit][/autoit][autoit]

    local $attr
    switch GuiCtrlRead ($kursiv)
    case 'kursiv'
    $attr += 2
    case 'unterstrichen'
    $attr += 4
    case ...
    endswitch

    [/autoit][autoit][/autoit][autoit]

    return $attr

    [/autoit][autoit][/autoit][autoit]

    endfunc

    [/autoit]


    LG
    Greenhorn


    2 Mal editiert, zuletzt von Greenhorn (14. März 2009 um 19:18)

  • so gehts :

    [autoit]

    #include <GUIConstantsEX.au3>

    [/autoit][autoit][/autoit][autoit]

    $hwnd = GUICreate("Word",300,300)
    GUISetBkColor(0xCDAD00)
    $IDC_EDIT = GUICtrlCreateEdit("Text",10,50,200,200)
    $IDC_COMBO = GUICtrlCreateCombo("10",10,10, 40)
    GUICtrlSetDAta(-1,"12|14|16|18")
    $kursiv = GUICtrlCreateCombo("2",60,10,70)
    GUICtrlSEtData(-1,"4")
    GUISetState(@SW_SHOW, $hwnd)

    [/autoit][autoit][/autoit][autoit]

    While 1

    Switch GUIGetMsg()
    case $kursiv
    GUICtrlSetFont ($IDC_EDIT, GUICtrlRead ($IDC_COMBO),400,GUICtrlRead($kursiv))

    Case $IDC_COMBO
    GUICtrlSetFont ($IDC_EDIT, GUICtrlRead ($IDC_COMBO))

    Case $GUI_EVENT_CLOSE
    ExitLoop
    EndSwitch

    WEnd

    [/autoit]
    • Offizieller Beitrag

    So:

    Spoiler anzeigen
    [autoit]


    #include <ComboConstants.au3>
    #include <GUIConstantsEX.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $hwnd = GUICreate("Word", 300, 300)
    GUISetBkColor(0xCDAD00)
    $IDC_EDIT = GUICtrlCreateEdit("Text", 10, 50, 200, 200)
    $hFont = GUICtrlCreateCombo("10", 10, 10, 40, 20)
    GUICtrlSetData(-1, "12|14|16|18")
    $hStyle = GUICtrlCreateCombo("normal", 60, 10, 90, 20, $CBS_DROPDOWNLIST)
    GUICtrlSetData(-1, "kursiv|unterstrichen")
    GUISetState(@SW_SHOW, $hwnd)

    [/autoit] [autoit][/autoit] [autoit]

    While 1

    [/autoit] [autoit][/autoit] [autoit]

    Switch GUIGetMsg()

    [/autoit] [autoit][/autoit] [autoit]

    Case $hFont, $hStyle
    $style = GUICtrlRead($hStyle)
    Switch $style
    Case "normal"
    $style = 0
    Case "kursiv"
    $style = 2
    Case "unterstrichen"
    $style = 4
    EndSwitch
    GUICtrlSetFont($IDC_EDIT, GUICtrlRead($hFont), 400, $style)

    [/autoit] [autoit][/autoit] [autoit]

    Case $GUI_EVENT_CLOSE
    ExitLoop
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    WEnd

    [/autoit]
    • Offizieller Beitrag

    So:

    [autoit]

    $hwnd = GUICreate("Word", 300, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX))

    [/autoit]

    Edit: und um der nächsten Frage zuvorzukommen:

    Resizing geht mit:

    [autoit]

    $hwnd = GUICreate("Word", 300, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))

    [/autoit]


    und die einzelnen Controls dann mit:

    [autoit]

    GUICtrlSetResizing(controlID, resizing)

    [/autoit]