AdvTree以编程方式选择所有节点

本文关键字:节点 选择 方式 编程 AdvTree | 更新日期: 2023-09-27 18:25:44

我正在尝试选择AdvTree上Ctrl+A上的所有节点。它被设置为允许多选。

我有事件PreviewKeyDown来检查ctrl,并按下A。

我试过这个:

For Each nd As Node In tvComputers.Nodes
    nd.SetSelectedCell(nd.Cells(0), Nothing)
Next

但它只选择了树中的最后一项,似乎没有添加到所选列表

AdvTree以编程方式选择所有节点

如果找到了它,我会毫不犹豫地让其他人看到,因为我在任何地方都找不到

 For Each nd As Node In tvComputers.Nodes
     tvComputers.SelectedNodes.Add(nd)
 Next