Skip to main content

CustomDrawEventArgs.DefaultDraw() Method

Performs default painting of an element.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v22.2.dll

NuGet Package: DevExpress.Win.Grid


public void DefaultDraw()


The DefaultDraw method can be useful if you need to draw custom information over the default element rendering. To do this, call the DefaultDraw method and then draw custom information using the methods provided by the CustomDrawEventArgs.Graphics object.

The DefaultDraw method automatically sets the CustomDrawEventArgs.Handled property to true to prevent additional default painting from being performed after a custom draw event handler has been completed.

The DefaultDraw method does nothing if the CustomDrawEventArgs.Handled property has already been set to true.


In the sample below, the GridView.CustomDrawCell event is handled to custom-paint data cells.

The CustomDrawEventArgs.DefaultDraw method applies the default draw to all cells. For all “Units in Stock” cells that display 0, a custom icon is drawn on top of this default cell rendering.


Image warningImage = Image.FromFile("c:\\warning.png");

private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) {
    if (e.Column.FieldName == "UnitsInStock") {
        if (Convert.ToInt32(e.CellValue) == 0)
            e.Cache.DrawImage(warningImage, e.Bounds.Location);
See Also