menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class GridDrawCellEventArgs - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class GridDrawCellEventArgs

    Provides data about the cancelable DrawCell event.

    Inheritance
    System.Object
    SyncfusionCancelEventArgs
    GridCellCancelEventArgs
    GridDrawCellEventArgs
    Inherited Members
    GridCellCancelEventArgs.ColIndex
    GridCellCancelEventArgs.RowIndex
    SyncfusionCancelEventArgs.ToString()
    Namespace: Syncfusion.Windows.Forms.Grid
    Assembly: Syncfusion.Grid.Windows.dll
    Syntax
    public sealed class GridDrawCellEventArgs : GridCellCancelEventArgs
    Remarks

    GridDrawCellEventArgs is a custom event argument class used by the DrawCell event to allow custom drawing of a cell. Set the Cancel property true if you have drawn the cell contents and do not want the grid to proceed with default drawing of the cell.

    Constructors

    GridDrawCellEventArgs(Graphics, GridCellRendererBase, Rectangle, Int32, Int32, GridStyleInfo, Boolean)

    Initializes a new instance of the GridDrawCellEventArgs class.

    Declaration
    public GridDrawCellEventArgs(Graphics graphics, GridCellRendererBase renderer, Rectangle bounds, int rowIndex, int colIndex, GridStyleInfo style, bool isBackgroundErased)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    Graphics context.

    GridCellRendererBase renderer

    The cell renderer.

    System.Drawing.Rectangle bounds

    Cell boundaries.

    System.Int32 rowIndex

    The row index.

    System.Int32 colIndex

    The column index.

    GridStyleInfo style

    The GridStyleInfo object that holds cell information.

    System.Boolean isBackgroundErased

    True if the cell background has already been drawn with the interior as specified in the style object.

    Properties

    Bounds

    Gets the Cell boundaries including borders and margins.

    Declaration
    [TraceProperty(true)]
    public Rectangle Bounds { get; }
    Property Value
    Type
    System.Drawing.Rectangle
    Remarks

    See PerformLayout(Int32, Int32) in order to calculate client and text rectangles without borders and margins.

    Graphics

    Gets the Graphics context.

    Declaration
    public Graphics Graphics { get; }
    Property Value
    Type
    System.Drawing.Graphics

    IsBackgroundErased

    Gets a value indicating whether the cell background has already been drawn with the interior as specified in the style object.

    Declaration
    [TraceProperty(true)]
    public bool IsBackgroundErased { get; }
    Property Value
    Type
    System.Boolean

    Renderer

    Gets or sets the GridCellRendererBase that is associated with that cell.

    Declaration
    [TraceProperty(true)]
    public GridCellRendererBase Renderer { get; set; }
    Property Value
    Type
    GridCellRendererBase
    Remarks

    Gets or sets the GridCellRendererBase that is associated with that cell. If you do not set System.Windows.Forms.Control.CancelEventArgs.Cancel to True, this renderer's Draw(Graphics, Rectangle, Int32, Int32, GridStyleInfo) will get called.

    Style

    Gets the style object associated with that cell.

    Declaration
    [TraceProperty(true)]
    public GridStyleInfo Style { get; }
    Property Value
    Type
    GridStyleInfo
    Remarks

    Changes to the style object are allowed. However, these changes will not be saved back in the grid or cached. But, you can make some adjustments to the style object just before the cell is drawn. You cannot change Base Style, Interior, or Cell Type at this time. See PrepareViewStyleInfo for changing interior or other style formatting.

    See Also

    GridDrawCellEventHandler
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved