menu

WinForms

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

    Show / Hide Table of Contents

    Class GridDrawCellBackgroundEventArgs

    Provides data about the cancelable DrawCellBackground event.

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

    GridDrawCellBackgroundEventArgs is a custom event argument class used by the DrawCellBackground event to allow custom drawing of a cell's background. Set the Cancel property true if you have drawn the cell's background and do not want the grid to proceed with default drawing of the cell's background.

    The event will automatically be called for covered cells and bannered cells. For regular cells, you can force this event by assigning BrushInfo.Empty to the Interior property of a GridStyleInfo.

    Otherwise this event will not be called for regular cells because of internal drawing optimizations within the grid. By default the grid optimizes drawing such that the background of neighboring cells with the same color are drawn in one operation.

    Constructors

    GridDrawCellBackgroundEventArgs(Graphics, GridRangeInfo, Boolean, Boolean, GridStyleInfo, Rectangle, Rectangle, Boolean)

    Initializes a new instance of the GridDrawCellEventArgs class.

    Declaration
    public GridDrawCellBackgroundEventArgs(Graphics graphics, GridRangeInfo range, bool isBannered, bool isColored, GridStyleInfo style, Rectangle targetBounds, Rectangle clipBounds, bool isClipped)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    Graphics context.

    GridRangeInfo range

    The cell's range. Can be several rows or columns if cell is a covered, floated, merged, or bannered cell.

    System.Boolean isBannered

    Indicates if this is a bannered cell.

    System.Boolean isColored

    Indicates if colored background should be drawn or black and white (see BlackWhite.

    GridStyleInfo style

    The GridStyleInfo object that holds cell information.

    System.Drawing.Rectangle targetBounds

    Cell boundaries.

    System.Drawing.Rectangle clipBounds

    The visible Cell area excluding cell parts that are scrolled out of view.

    System.Boolean isClipped

    Indicates if the graphics canvas already clips the drawing contents.

    Properties

    ClipBounds

    Gets the visible cell area excluding cell parts that are scrolled out of view.

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

    Graphics

    Gets Graphics context.

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

    IsBannered

    Gets a value indicating whether this is a bannered cell.

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

    IsClipped

    Gets a value indicating whether the graphics canvas already clips the drawing contents.

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

    IsColored

    Gets a value indicating whether colored background should be drawn or black and white (see BlackWhite.

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

    Range

    Gets the cell's range. Can be several rows or columns if cell is a covered, floated, merged, or bannered cell.

    Declaration
    [TraceProperty(true)]
    public GridRangeInfo Range { get; }
    Property Value
    Type
    GridRangeInfo

    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 however. See PrepareViewStyleInfo for changing interior or other style formattings.

    TargetBounds

    Gets Cell boundaries including borders and margins.

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

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

    See Also

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