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

PivotCustomDrawCellEventArgs Class

Provides data for the PivotGridControl.CustomDrawCell event.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v17.2.dll

Declaration

public class PivotCustomDrawCellEventArgs :
    PivotCustomDrawCellBaseEventArgs

Remarks

The PivotCustomDrawCellEventArgs class provides properties that allows you to identify the painted cell’s bounding rectangle, appearance settings, content, etc. The field whose cell is being painted is represented by the PivotCustomDrawCellBaseEventArgs.DataField property.

The PivotCustomDrawCellEventArgs.Handled property specifies whether default painting is required after the event handler has executed. If this property is set to true within a handler then the default painting is cancelled. Otherwise, any custom painting performed within an event handler will be overridden by the Pivot Grid Control’s standard painting.

Note

You cannot use the PivotCustomDrawCellEventArgs class members to access event data while an asynchronous operation is being performed. Use the pivot grid’s IThreadSafeAccessible.IsAsyncInProgress property to determine whether an operation is in progress. If this property returns true, use a thread-safe event parameter returned by the PivotCustomDrawCellEventArgs.ThreadSafeArgs property to access event data. To learn more, see Asynchronous Mode.

Example

The following sample code handles the PivotGridControl.CustomDrawCell event to custom paint Grand Total cells. The image below shows the result.

PivotGrid_CustomDrawCell

using System.Drawing.Drawing2D;
using DevExpress.XtraPivotGrid;

private void pivotGridControl1_CustomDrawCell(object sender, PivotCustomDrawCellEventArgs e) {
   if(e.ColumnValueType == PivotGridValueType.GrandTotal || 
      e.RowValueType == PivotGridValueType.GrandTotal) {
      e.GraphicsCache.FillRectangle(new LinearGradientBrush(e.Bounds, Color.LightBlue, 
        Color.Blue, LinearGradientMode.Vertical), e.Bounds);
      Rectangle innerRect = Rectangle.Inflate(e.Bounds, -3, -3);
      e.GraphicsCache.FillRectangle(new LinearGradientBrush(e.Bounds, Color.Blue, 
        Color.LightSkyBlue, LinearGradientMode.Vertical), innerRect);
      e.GraphicsCache.DrawString(e.DisplayText, e.Appearance.Font, 
        new SolidBrush(Color.White), innerRect, e.Appearance.GetStringFormat());
      e.Handled = true;
   }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the PivotCustomDrawCellEventArgs class.

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.

Inheritance

See Also