How to Custom Paint Data Cells
The following example demonstrates how to handle the tree list’s OnCustomDrawDataCell event, used to manually paint data cells.
In the example, only selected data cells are custom painted. For the required result, the following settings have been specified: the tree list’s OptionsSelection.CellSelect property is True, and the OptionsSelection.InvertSelect property is False.
// Delphi
// …
procedure <Form>.<TreeList>CustomDrawDataCell(Sender: TcxCustomTreeList; ACanvas: TcxCanvas; AViewInfo: TcxTreeListEditCellViewInfo; var ADone: Boolean);
begin
if not AViewInfo.Selected then Exit
else
begin
//paint the focused node
ACanvas.Brush.Color := $80FFFF;
end;
end;
This is the code execution result: