Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>
TTreeList
How to set the background color per item
How to set the background color per item
To set the background color per item, implement OnCustomDrawItem and set the Canvas.Brush.Color from this event.
This example code snippet applies color banding to TTreeList:
procedure TForm1.TreeList1CustomDrawItem(Sender: TCustomTreeView; Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean); begin if odd(Node.Index) then TreeList1.Canvas.Brush.Color := clInfoBk else TreeList1.Canvas.Brush.Color := clWindow; end;