德尔福VirtualStringTree图 [英] Delphi VirtualStringTree Drawing

查看:362
本文介绍了德尔福VirtualStringTree图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have been trying to figure these 2 things out:

1)如何改变整个排在code颜色?就像,当VT看起来像一个ListView?

1) How do I change the whole row's color in code? Like, when the VT looks like a ListView?

2)如何使复选框缩进藏汉?我的孩子复选框,并于同缩进?因为我的根复选框。

2) How do I make the Checkboxes indent aswell? My child checkboxes and on the same "indent?" as my root checkboxes.

谢谢!

推荐答案

1)

procedure VSTBeforeItemErase(
  Sender: TBaseVirtualTree; TargetCanvas: TCanvas; Node: PVirtualNode;
  ItemRect: TRect; var ItemColor: TColor;
  var EraseAction: TItemEraseAction);
begin
  EraseAction := eaColor;
  ItemColor := clLime;
end;

2)的缩进设置为每个节点复选框分别是恕我直言不可能的。 树有其缩进属性,它为所有节点(包括其复选框)缩进。内部的AdjustCoordinatesByIndent和PaintCheckImage方法被调用,但两者都隐藏着你。其中之一的修改可以帮助你,但你需要非常具体的,我会说最好是创建自己的组件后裔。

2) The indent setting for each node check box separately is IMHO impossible. The tree has its Indent property, which sets the indention for all nodes (including their check boxes). Internally the AdjustCoordinatesByIndent and PaintCheckImage methods are called, but both are hidden for you. Modification of one of them can help you, but you need to be very specific, I would say the best would be to create your own component descendant.

如果你想创造的东西是什么先进例如属性页面,则需要将节点添加到多个级别的树状分层结构。

If you want to create something what is in property page of the advanced example, you need to add nodes to more than one level in the tree hierarchy.

有关你的灵感...

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;

这篇关于德尔福VirtualStringTree图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆