#include <FontConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUITreeView.au3>
#include <WindowsConstants.au3>
$hGUI = GUICreate("(UDF Created) TreeView Create", 400, 300)
$g_hTreeView = _GUICtrlTreeView_Create($hGUI, 2, 2, 396, 268, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_BeginUpdate($g_hTreeView)
For $x = 1 To 5
$hItem = _GUICtrlTreeView_Add($g_hTreeView, 0, StringFormat("[%02d] New Item", $x))
For $y = 1 To 5
_GUICtrlTreeView_AddChild($g_hTreeView, $hItem, StringFormat("[%02d] New Child", $y))
Next
Next
_GUICtrlTreeView_EndUpdate($g_hTreeView)
$hFont = _WinAPI_CreateFont(12.0, 0, 0, 0, $FW_NORMAL, 0, 0, 0, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Segoe UI')
_WinAPI_SetFont($g_hTreeView, $hFont)
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()