Skip to main content
A newer version of this page is available. .

How to: Create a custom painter to override the way footers are painted

The code below creates a simple paint helper, deriving it from the standard TreeListPaintHelper class. The DrawFooterBackGround method is overridden to custom paint the summary footer.

The image below shows the Tree List control before and after the code has been executed.

CustomPaintHelper - Footer

using DevExpress.Utils;
using DevExpress.XtraTreeList;
using DevExpress.XtraTreeList.Painter;
using System.Drawing.Drawing2D;
// ...
public class SimplePaintHelper : TreeListPaintHelper {
    internal SimplePaintHelper(ImageList il_Indicator) : base() { }
    public override void DrawFooterBackGround(CustomDrawEventArgs e) {
        LinearGradientBrush brush = new LinearGradientBrush(e.Bounds, Color.FromArgb(244, 210, 227), Color.FromArgb(207, 196, 230), LinearGradientMode.Vertical);
        using (brush) {
            e.Graphics.FillRectangle(brush, e.Bounds);
        }
    }
}


//...
// Use the painter:
treeList1.Painter.DefaultPaintHelper = new SimplePaintHelper(treeList1.Painter.IndicatorImages);