有没有办法改变TTreeView中节点的颜色。我想用深色为树视图着色,然后我看不到节点。
答案 0 :(得分:3)
您只想更改线条颜色并不容易。 无论如何,API中有一条消息;
uses
commctrl;
procedure TForm1.FormCreate(Sender: TObject);
begin
SendMessage(TreeView1.Handle, TVM_SETLINECOLOR, 0, ColorToRGB(clYellow));
end;
答案 1 :(得分:1)
也许你可以使用TTreeView的OnCustomDrawItem事件:
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;