Hi all
Is there any way to change the color of the nodes in a TTreeView. I want to color my treeview with a dark color and then I can't see the nodes.
Hi all
Is there any way to change the color of the nodes in a TTreeView. I want to color my treeview with a dark color and then I can't see the nodes.
maybe you can use OnCustomDrawItem event of TTreeView:
procedure TForm1.TreeView1CustomDrawItem(Sender: TCustomTreeView;
Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
with Sender as TCustomTreeView do
begin
Canvas.Brush.Color := clBlack;
Canvas.Font.Color := clBlack
end;
end;
It is not easily evident that you only wanted to change the line color. Anyway, there's a message for that in the API;
uses
commctrl;
procedure TForm1.FormCreate(Sender: TObject);
begin
SendMessage(TreeView1.Handle, TVM_SETLINECOLOR, 0, ColorToRGB(clYellow));
end;