[已解决]问一个Tree控件的问题
本帖最后由 Xxkwwz 于 2021-8-5 20:37 编辑我调出来了多选框,但是怎么一层选中,里面自动全选,求大神帮忙,谢谢 上代码看下 #PRE_UseX64=n
#include <GUIConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>
Opt('GUIOnEventMode', 1)
Global $MainForm = GUICreate("TreeView Set Checked", 400, 300)
Global $TreeView = GUICtrlCreateTreeView(0, 0, 300, 200, BitOR($GUI_SS_DEFAULT_TREEVIEW, $TVS_CHECKBOXES))
Global $TreeViewP1 = GUICtrlCreateTreeViewItem("父节点1", $TreeView)
Global $TreeViewC11 = GUICtrlCreateTreeViewItem("子节点1", $TreeViewP1)
Global $TreeViewC12 = GUICtrlCreateTreeViewItem("子节点2", $TreeViewP1)
Global $TreeViewP2 = GUICtrlCreateTreeViewItem("父节点2", $TreeView)
Global $TreeViewC21 = GUICtrlCreateTreeViewItem("子节点1", $TreeViewP2)
Global $TreeViewC22 = GUICtrlCreateTreeViewItem("子节点2", $TreeViewP2)
GUISetState()
GUICtrlSetOnEvent($TreeViewP1, '_SetTreeChecked')
GUICtrlSetOnEvent($TreeViewP2, '_SetTreeChecked')
GUISetOnEvent(-3, '_exit')
While 1
Sleep(20)
WEnd
Func _SetTreeChecked()
Local $hChild = _GUICtrlTreeView_GetFirstChild($TreeView, _GUICtrlTreeView_GetSelection($TreeView))
While $hChild
_GUICtrlTreeView_SetChecked($TreeView, $hChild, _GUICtrlTreeView_GetChecked($TreeView, _GUICtrlTreeView_GetSelection($TreeView)))
$hChild = _GUICtrlTreeView_GetNextChild($TreeView, $hChild)
WEnd
EndFunc ;==>_SetTreeChecked
Func _exit()
Exit
EndFunc ;==>_exit
haijie1223 发表于 2021-8-2 22:57
谢谢发哥指教,感谢 haijie1223 发表于 2021-8-2 22:57
差评,说好的让他上代码呢?
Xxkwwz 发表于 2021-8-3 08:27
谢谢发哥指教,感谢
看版规,修改标题~
页:
[1]