本帖最后由 yhxhappy 于 2010-12-19 01:03 编辑
我觉得是,点[+]号展开,选取一个子项,当点父项旁边的[—]号收起来的时候,选择的焦点会转移到父项,此时程序就会认为你选了父项,所以就把它下面的子项全选中了
把以下代码替换到脚本中试试,我在10楼链接里的脚本验证成功,楼主没有给我INI文档,我没法验证
Case $aFitem[0][0] To $aFitem[UBound($aFitem) - 1][0] ;父项目
If BitAND(GUICtrlRead($nMsg), $GUI_CHECKED) Then ;如果父项目勾选,其下所有子项目全选。
$iSitemNumber = Number(_GUICtrlTreeView_GetChildCount($TreeView1, $nMsg))
$Switch = 0
For $i = $nMsg To $nMsg + $iSitemNumber
If $i <> $nMsg And BitAND(GUICtrlRead($i), $GUI_CHECKED) Then $Switch += 1
Next
If $Switch = 0 Then
For $i = $nMsg To $nMsg + $iSitemNumber
GUICtrlSetState($i, $GUI_CHECKED)
Next
EndIf
Else
$iSitemNumber = Number(_GUICtrlTreeView_GetChildCount($TreeView1, $nMsg))
For $i = $nMsg To $nMsg + $iSitemNumber
GUICtrlSetState($i, $GUI_UNCHECKED)
Next
EndIf
ContinueCase
|