I want to devide the columns in my TAdvTreeView with a vertical line of 1 pixel in diameter. This seems to be not possible.
The only way to get a vertical line is to set NodesAppearance ColumnStroke Width to 1. But then the columns get a line of 1 around them on all sides, resulting in a vertical line with a width of 2 between the columns. The headers do have a vertical line of 1...
You're correct. We will fix this.
Hi,
We'll look into improving/fixing the behaviour, but you can also workaround it by drawing a line instead of a rectangle with the following code:
procedure TForm1.AdvTreeView1AfterDrawColumn(Sender: TObject; ACanvas: TCanvas;
ARect: TRectF; AColumn: Integer);
begin
ACanvas.MoveTo(Round(ARect.Right), Round(ARect.Top));
ACanvas.LineTo(Round(ARect.Right), Round(ARect.Bottom));
end;
procedure TForm1.AdvTreeView1BeforeDrawColumn(Sender: TObject;
ACanvas: TCanvas; ARect: TRectF; AColumn: Integer; var AAllow,
ADefaultDraw: Boolean);
begin
ADefaultDraw := False;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
AdvTreeView1.ColumnStroke.Style := psSolid;
AdvTreeView1.ColumnStroke.Color := clRed;
end;
This workaround does not work when the GetNodecolor event is used, as I do. I use it to get colored rows like this:
procedure TFormEenKolomTree.TVGetNodeColor(Sender: TObject; ANode: TAdvTreeViewVirtualNode; var AColor: TColor);
begin
if (ANode.Children = 0) then
begin
if (ANode.Index mod 2) = 0 then AColor := clWhite
else AColor := $00F4F4F4;
end;
end;
The column stroke is always painted under the nodes, therefore, filling the nodes will override the line drawing. We have added this on our todolist for further investigation.