Delphi VirtualStringTree绘图

Delphi VirtualStringTree绘图,delphi,listview,virtualtreeview,Delphi,Listview,Virtualtreeview,我一直在试图弄清楚这两件事: 1) 如何在代码中更改整行的颜色?比如,当VT看起来像ListView时 2) 如何使复选框也缩进?我的子复选框和根复选框位于同一个“缩进”上 谢谢 1)尝试将tofullrow选择添加到TreeOptions。选择选项 2) 我不能回答这个问题。也许可以尝试toFixedIndent1) 2) 不可能单独设置每个节点的缩进复选框树具有其缩进属性,该属性设置所有节点(包括其复选框)的缩进。在内部调用AdjustCoordinates ByIndent和PaintCh

我一直在试图弄清楚这两件事:

1) 如何在代码中更改整行的颜色?比如,当VT看起来像ListView时

2) 如何使复选框也缩进?我的子复选框和根复选框位于同一个“缩进”上

谢谢

1)尝试将
tofullrow选择
添加到
TreeOptions。选择选项

2) 我不能回答这个问题。也许可以尝试
toFixedIndent

1)

2) 不可能单独设置每个节点的缩进复选框树具有其缩进属性,该属性设置所有节点(包括其复选框)的缩进。在内部调用AdjustCoordinates ByIndent和PaintCheckImage方法,但这两种方法都是隐藏的。修改其中一个组件可以帮助您,但您需要非常具体,我认为最好是创建您自己的组件后代

若要创建高级示例的属性页中的内容,则需要将节点添加到树层次结构中的多个级别

为了你的灵感

var CurrentNode: PVirtualNode;
    CurrentSubnode: PVirtualNode;

begin
  VirtualStringTree1.Indent := 50; // this increases indention for all nodes in the tree

  CurrentNode := VirtualStringTree1.AddChild(nil); // create a node to the root
  CurrentNode.CheckType := ctCheckBox; // check support of a node
  CurrentSubnode := VirtualStringTree1.AddChild(CurrentNode); // create a subnode to your first node
  CurrentSubnode.CheckType := ctCheckBox; // check support of a node
end;

欢迎来到SO!两个问题应该对应两个问题。如果有人知道你问题的答案怎么办?这是否符合你的综合问题的答案?1)你想选择整行还是改变每行的背景?你很可能是16岁的电脑天才(原文如此),但真的,你不能在这里使用你的真实帐户,而不是增殖的人物角色吗?!2) 否,toFixedIndent将所有节点缩进到同一位置
var CurrentNode: PVirtualNode;
    CurrentSubnode: PVirtualNode;

begin
  VirtualStringTree1.Indent := 50; // this increases indention for all nodes in the tree

  CurrentNode := VirtualStringTree1.AddChild(nil); // create a node to the root
  CurrentNode.CheckType := ctCheckBox; // check support of a node
  CurrentSubnode := VirtualStringTree1.AddChild(CurrentNode); // create a subnode to your first node
  CurrentSubnode.CheckType := ctCheckBox; // check support of a node
end;