C1.Win.C1FlexGrid Namespace > C1FlexGridBase Class : OwnerDrawCell Event |
'Declaration
<C1DescriptionAttribute("Fires before the grid draws a cell, when the DrawMode property is set to OwnerDraw.")> Public Event OwnerDrawCell As OwnerDrawCellEventHandler
'Usage
Dim instance As C1FlexGridBase Dim handler As OwnerDrawCellEventHandler AddHandler instance.OwnerDrawCell, handler
[C1Description("Fires before the grid draws a cell, when the DrawMode property is set to OwnerDraw.")] public event OwnerDrawCellEventHandler OwnerDrawCell
[C1Description("Fires before the grid draws a cell, when the DrawMode property is set to OwnerDraw.")] public: event OwnerDrawCellEventHandler^ OwnerDrawCell
The event handler receives an argument of type OwnerDrawCellEventArgs containing data related to this event. The following OwnerDrawCellEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Bounds | Get the rectangle where the cell will be painted (in client coordinates). |
Col | Get the column index of the cell being painted. |
Graphics | Gets the Graphics object used to draw the cell. Use this object to draw custom elements in the cell. |
Handled | Gets or sets whether the event has finished drawing the cell. |
Image | Gets or sets the image that will be displayed in the cell. |
Measuring | Gets a value that determines if the event was fired only to measure the cell. |
Row | Get the row index of the cell being painted. |
Style | Sets or sets the CellStyle object used to paint the cell. |
Text | Gets or sets the text that will be displayed in the cell. |
The OwnerDrawCell event only fires when the DrawMode property is set to DrawModeEnum.OwnerDraw.
You can use this event to customize the appearance of any cell in the grid. The event allows three main types of customization:
The OwnerDrawCell event also fires when the grid auto sizes rows or columns (see the AutoSizeRows(Int32,Int32,Int32,Int32,Int32,AutoSizeFlags) and AutoSizeCols(Int32,Int32,Int32,Int32,Int32,AutoSizeFlags) methods). This is done because the grid needs to measure the cell using the same text, image, and style parameters that are used to render it. In these cases, the Measuring parameter is set to true and the Bounds rectangle is empty.
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2