有没有办法改变TTreeView中节点的颜色?我想用深色来着色我的树形视图,但是我看不到节点。以下是需要翻译的内容:
您只想更改行颜色并不容易明显。 无论如何,API中都有相关信息;
uses
commctrl;
procedure TForm1.FormCreate(Sender: TObject);
begin
SendMessage(TreeView1.Handle, TVM_SETLINECOLOR, 0, ColorToRGB(clYellow));
end;
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;