Skip to main content

How to Custom Paint Footer Cells

The tree list’s OnCustomDrawFooterCell event is used to manually paint both group footer cells and footer cells. In the handler implementation, these elements can be distinguished using the AViewInfo.Node property that references the node against which summaries are calculated. Footer cells always represent summaries calculated against the root node. In the example, the node is identified via the node’s Level property, which returns -1 for the root node.

The following example demonstrates how to handle the OnCustomDrawFooterCell event, so that footers and group footers are painted differently.

//...
procedure <Form>.<TreeList>CustomDrawFooterCell(Sender: TObject; ACanvas: TcxCanvas; AViewInfo: TcxTreeListFooterCellViewInfo;
  var ADone: Boolean);
begin
  if AViewInfo.Node.Level = -1 then
    //paint footer cells
    ACanvas.Brush.Color := $9988FE
  else
    //paint group footer cells
    ACanvas.Brush.Color := $D0FFD0;
end;

This is the code execution result: