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

GridView.CustomDrawFooter Event

Enables you to paint the view footer manually.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v18.1.dll

Declaration

[DXCategory("CustomDraw")]
public event RowObjectCustomDrawEventHandler CustomDrawFooter

Event Data

The CustomDrawFooter event's data class is RowObjectCustomDrawEventArgs. The following properties provide information specific to this event:

Property Description
Appearance Gets the painted element’s appearance settings. Inherited from CustomDrawEventArgs.
Bounds Returns a value specifying limits for the drawing area. Inherited from CustomDrawEventArgs.
Cache Provides methods to paint on drawing surfaces in GDI+ and DirectX modes. See DirectX hardware acceleration to learn more. Inherited from CustomDrawEventArgs.
Graphics A GDI+ drawing surface. Use the CustomDrawEventArgs.Cache property instead if you enable the DirectX hardware acceleration. Inherited from CustomDrawEventArgs.
Handled Gets or sets a value specifying whether an event was handled and that the default element painting is therefore not required. Inherited from CustomDrawEventArgs.
Info Gets an object containing information about the painted element. Inherited from CustomDrawObjectEventArgs.
Painter Gets the painter object that provides the default element painting mechanism. Inherited from CustomDrawObjectEventArgs.
RowHandle Gets the handle of the row whose corresponding element is being painted.

The event data class exposes the following methods:

Method Description
DefaultDraw() Performs default painting of an element. Inherited from CustomDrawEventArgs.

Remarks

The CustomDrawFooter event is raised each time the footer needs to be repainted. Handle it to paint the footer panel manually. See the Custom Painting Basics and Custom Painting Scenarios topics for information on using custom draw events.

Note

The control’s events designed to change the appearance or rendering of control elements must not be used to update cell values or to modify the control’s layout. Any inappropriate operation which causes a layout update, may break the normal control behavior.

Example

In this example the Grid column footer is manually re-painted to display information on cell colors. To re-paint cells themselves, handle the GridView.CustomDrawCell event.

GridControl - CustomDrawFooter

private void Form3_Load1(object sender, EventArgs e) {
    CustomDrawFooter(gridControl1, gridView1);
}

public static void CustomDrawFooter(GridControl gridControl, GridView gridView) {
    gridView.OptionsView.ShowFooter = true;
    gridView.FooterPanelHeight = 70;

    Color highPriority = Color.Green;
    Color normalPriority = Color.Orange;
    Color lowPriority = Color.Red;
    int markWidth = 16;

    // Handle this event to paint the footer panel manually
    gridView.CustomDrawFooter += (s, e) => {
        int offset = 5;
        e.DefaultDraw();
        Color color = highPriority;
        Rectangle markRectangle;
        string priorityText = " - High level";
        for (int i = 0; i < 3; i++) {
            if (i == 1) {
                color = normalPriority;
                priorityText = " - Normal level";
            }
            else if (i == 2) {
                color = lowPriority;
                priorityText = " - Low level";
            }
            markRectangle = new Rectangle(e.Bounds.X + offset, e.Bounds.Y + offset + (markWidth + offset) * i, markWidth, markWidth);
            e.Cache.FillEllipse(markRectangle.X, markRectangle.Y, markRectangle.Width, markRectangle.Height, color);
            e.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            e.Appearance.Options.UseTextOptions = true;
            e.Appearance.DrawString(e.Cache, priorityText, new Rectangle(markRectangle.Right + offset, markRectangle.Y, e.Bounds.Width, markRectangle.Height));
        }
    };
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CustomDrawFooter event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also