TreeView - como desenhas niveis em cores diferente (canvas)

Top  Previous  Next

procedure TAtalhosForm.CompsTreeAdvancedCustomDrawItem(Sender: TCustomTreeView; Node: TTreeNode; State: TCustomDrawState;

                                                       Stage: TCustomDrawStage; var PaintImages, DefaultDraw: Boolean);

const

  Cor: array[0..9of TColor = (clBlack, clMaroon, clGreen, clOlive, clNavy, clPurple, clTeal, clGray, clBlack, clMaroon);

begin

  DefaultDraw := True;

  CompsTree.Canvas.Font.Color  := Cor[Node.Level];

end;