delphi – 具有隐藏节点的Color VirtualStringTree行
发布时间:2020-12-15 09:21:09 所属栏目:大数据 来源:网络整理
导读:我目前在我的树的OnBeforeCellPaint事件中使用此代码: if Node.Index mod 2 = 0 thenbegin TargetCanvas.Brush.Color := clBlack; TargetCanvas.FillRect(CellRect);endelsebegin TargetCanvas.Brush.Color := clPurple; TargetCanvas.FillRect(CellRect);e
我目前在我的树的OnBeforeCellPaint事件中使用此代码:
if Node.Index mod 2 = 0 then begin TargetCanvas.Brush.Color := clBlack; TargetCanvas.FillRect(CellRect); end else begin TargetCanvas.Brush.Color := clPurple; TargetCanvas.FillRect(CellRect); end; 为我的节点着色. 提前致谢. 解决方法
目前没有这种方法来获取可见性节点索引.但是,您可以在自己的位置迭代可见节点并计算每次迭代.这样的事情(你如何在实际代码中实现它):
function GetVisibleIndex(Tree: TBaseVirtualTree; Node: PVirtualNode): Integer; var P: PVirtualNode; begin Assert(Assigned(Node),'Node must not be nil!'); Assert(Tree.IsVisible[Node],'Node must be visible!'); Result := 0; P := Tree.GetFirstVisible; while Assigned(P) and (P <> Node) do begin Inc(Result); P := Tree.GetNextVisible(P); end; end; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |