[Resolved] TTreeView Changing Arrow based on Selection Status lazarus / 31-LCL ---------------------------------------------------------------------- daz · 2018-11-25 20:59 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). Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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; ---------------------------------------------------------------------- wp · 2018-11-25 21:32 Use the method GetNodeAt(X,Y) to determine the node from the rectangle passed as a parameter: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.TreeView1CustomDrawArrow(Sender: TCustomTreeView;  const ARect: TRect; ACollapsed: Boolean);var  node: TTreeNode;begin  node := Sender.GetNodeAt(ARect.Left+1, ARect.Top+1);  if node = Sender.Selected then begin      // this is for selected node  end else    // this is for normal nodeend; ---------------------------------------------------------------------- daz · 2018-11-25 21:54 This works perfect, thanks a bunch!