I am doing a lot of color customization / butchering with TTreeView
One of things I have done is changed the selection color and enabled RowSelect
OnCustomDrawArrow works great, except I don't think there's a way to tell if the current item the arrow being drawn for is a selected item or not.
For example, see my attached screenshots.
I would like that if I am drawing the arrow for the currently selected node, I would draw the arrow in a different color (black).
procedure TfrmMain.tvNotebookCustomDrawArrow(Sender: TCustomTreeView;
const ARect: TRect; ACollapsed: Boolean);
var
points: array of TPoint;
begin
Sender.Canvas.Brush.Color := clBlack;
Sender.Canvas.FillRect(ARect);
Sender.Canvas.Pen.Width := 0;
Sender.Canvas.Pen.Color := clWhite;
Sender.Canvas.Brush.Color := clWhite;
if ACollapsed then begin
SetLength(points, 3);
points[0] := Point(ARect.Left, ARect.Top);
points[1] := Point(ARect.Left, ARect.Top + ARect.Height);
points[2] := Point(ARect.Left + ARect.Width, ARect.Top + ARect.Height div 2);
Sender.Canvas.Polygon(points);
end else begin
SetLength(points, 3);
points[0] := Point(ARect.Left, ARect.Top);
points[1] := Point(ARect.Left + ARect.Width, ARect.Top);
points[2] := Point(ARect.Left + ARect.Width div 2, ARect.Top + ARect.Height);
Sender.Canvas.Polygon(points);
end;
Sender.Canvas.Brush.Style := bsClear;
end;