PivotCustomDrawCellEventArgs Class

Provides data for the PivotGridControl.CustomDrawCell event.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v20.1.dll

Declaration

public class PivotCustomDrawCellEventArgs :
    PivotCustomDrawCellBaseEventArgs
Public Class PivotCustomDrawCellEventArgs
    Inherits 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.

Examples

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;
   }
}

Inheritance

See Also