如何在虚拟树视图中隐藏 expand/collapse 按钮?

How to hide expand/collapse button in Virtual Treeview?

我使用 VirtualStringTree (VST) 来显示分组的数据,header-details。我需要有一个选项允许用户展开、折叠 headers 以查看详细信息,并且在某些情况下我需要将数据显示为静态视图,它们无法展开、折叠,只能看到完整的展开树:

以下是用户可以使用 child 节点展开、折叠节点的示例:

下面是我想阻止用户访问 expand/collapse 节点并始终看到所有扩展(或显示的任何内容)的示例:

在此测试中,我通过“允许 Expand/Collapse/ 复选框进行控制。

我通过添加来防止展开、折叠:

Allowed:=CheckBox1.Checked;

进入OnCollapsing/OnExpanding:

procedure TMainForm.VSTCollapsing(Sender: TBaseVirtualTree;
  Node: PVirtualNode; var Allowed: Boolean);
begin
  Allowed:=CheckBox1.Checked;
end;

procedure TMainForm.VSTExpanding(Sender: TBaseVirtualTree;
  Node: PVirtualNode; var Allowed: Boolean);
begin
  Allowed:=CheckBox1.Checked;
end;

我还 show/hide 基于复选框的 TreeLines

procedure TMainForm.CheckBox1Click(Sender: TObject);
begin
  if CheckBox1.Checked then
    VST.TreeOptions.PaintOptions:=VST.TreeOptions.PaintOptions + [toShowTreeLines]
  else
    VST.TreeOptions.PaintOptions:=VST.TreeOptions.PaintOptions - [toShowTreeLines];
end;

当我想防止用户展开、折叠节点时,如何隐藏这个小加号。有什么建议吗?


编辑:

为了消除与表单图标的混淆,这是来自 Virtual Treeivew 5 演示库的演示项目。 IDE 中的表格有Delphi XE7 图标,当运行 项目出现这个旧图标。不知道为什么。只是想确保清楚我使用的是 XE7 而不是任何旧的 Delphi 版本,相同的解决方案可能不适用。

在IDE中的图标如果是XE7图标:

您正在寻找的附加选项是 toShowButtons。在使用 toShowTreeLines.

的相同位置使用它

该选项记录在 VirtualTrees.pas 的声明中 TVTPaintOption:

    toShowButtons,             // Display collapse/expand buttons left to a node.