Glyph Posted July 22, 2009 Posted July 22, 2009 (edited) http://www.autoitscript.com/forum/index.php?showtopic=44286&st=0&p=330369&hl=treeview%20font&fromsearch=1&#entry330369 So close, but not quite there. That's the same problem I am having! I've tried GUICtrlSetFont with no success. Changing the whole treeview font is my problem. $hTreeView = _GUICtrlTreeView_Create($GUI, 2, 10, 120, 322) GUICtrlSetFont($hTreeView, 7, 200, Default, "Courier") _GUICtrlTreeView_BeginUpdate($hTreeView) For $x = 1 To Random(2, 10, 1) $hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x)) For $y = 1 To Random(2, 10, 1) _GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y)) Next Next _GUICtrlTreeView_EndUpdate($hTreeView) I appreciate any help, thanks. Edited July 22, 2009 by Glyph tolle indicium
Authenticity Posted July 22, 2009 Posted July 22, 2009 #include <GUITreeView.au3> #include <WindowsConstants.au3> $GUI = GUICreate('Test', 420, 420) ;$hTreeView = _GUICtrlTreeView_Create($GUI, 2, 10, 120, 322) $TreeView = GUICtrlCreateTreeView(10, 10, 400, 400, -1, $WS_EX_CLIENTEDGE) $hTreeView = GUICtrlGetHandle($TreeView) ;GUICtrlSetFont(_WinAPI_GetDlgCtrlID($hTreeView), 7, 200, Default, "Courier") GUICtrlSetFont($TreeView, 7, 200, Default, "Courier") _GUICtrlTreeView_BeginUpdate($hTreeView) For $x = 1 To Random(2, 10, 1) $hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x)) For $y = 1 To Random(2, 10, 1) _GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y)) Next Next _GUICtrlTreeView_EndUpdate($hTreeView) GUISetState() Do Until GUIGetMsg() = -3 _GUICtrlTreeView_Destroy($hTreeView) GUIDelete() Exit It won't work this way without creating the control using the native functions, i.e. GUICtrlCreate*. You can use the _WinAPI_SetFont() function with a font object to change the window font: expandcollapse popup#include <FontConstants.au3> #include <GUITreeView.au3> #include <WindowsConstants.au3> $hFont = _WinAPI_CreateFont(10, _ 10, _ 0, _ 0, _ $FW_NORMAL, _ False, _ False, _ False, _ $DEFAULT_CHARSET, _ $OUT_OUTLINE_PRECIS, _ $CLIP_DEFAULT_PRECIS, _ $DEFAULT_QUALITY, _ $DEFAULT_PITCH, _ 'Courier') $GUI = GUICreate('Test', 420, 420) $hTreeView = _GUICtrlTreeView_Create($GUI, 10, 10, 400, 400) If $hFont Then _WinAPI_SetFont($hTreeView, $hFont) _GUICtrlTreeView_BeginUpdate($hTreeView) For $x = 1 To Random(2, 10, 1) $hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x)) For $y = 1 To Random(2, 10, 1) _GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y)) Next Next _GUICtrlTreeView_EndUpdate($hTreeView) GUISetState() Do Until GUIGetMsg() = -3 _GUICtrlTreeView_Destroy($hTreeView) If $hFont Then _WinAPI_DeleteObject($hFont) GUIDelete() Exit
Glyph Posted July 22, 2009 Author Posted July 22, 2009 That's exactly what I was looking for, thank you. tolle indicium
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now