in der demo ist ein beispiel.
hab die mal den code rauskopiert:
Delphi-Quellcode:
procedure TNodeForm.MLTreeMeasureItem(Sender: TBaseVirtualTree; TargetCanvas: TCanvas; Node: PVirtualNode;
var NodeHeight: Integer);
begin
if Sender.MultiLine[Node] and AutoAdjustCheckBox.Checked then
begin
TargetCanvas.Font := Sender.Font;
NodeHeight := MLTree.ComputeNodeHeight(TargetCanvas, Node, 0);
end;
// ...else use what's set by default.
end;
procedure TNodeForm.MLTreeInitNode(Sender: TBaseVirtualTree; ParentNode, Node: PVirtualNode;
var InitialStates: TVirtualNodeInitStates);
begin
Node.Align := 20; // Alignment of expand/collapse button nearly at the top of the node.
if (Node.Index mod 3) = 0 then
begin
MLTree.NodeHeight[Node] := 40;
end
else
begin
MLTree.NodeHeight[Node] := 120;
Include(InitialStates, ivsMultiline);
end;
end;
procedure TNodeForm.AutoAdjustCheckBoxClick(Sender: TObject);
begin
MLTree.ReinitNode(nil, True);
MLTree.Invalidate;
end;