Class GridDataBoundRowHeaderCellRenderer
Implements the renderer part of a row header cell in a GridDataBoundGrid. The row header cell will display an arrow for the current row, a star for the append row, and a pencil when the row is being edited.
Inheritance
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public class GridDataBoundRowHeaderCellRenderer : GridHeaderCellRenderer, IQueryFocusInside, IGridDropDownCell, IPopupParent, IPopupItem, IDisposable
Remarks
Defines the renderer part of a row header cell. A renderer is created for each GridCellModelBase and GridControlBase. There can be several renderers associated with one GridDataBoundRowHeaderCellRenderer if several views display the same GridModel.
The header cell is XP Themes enabled. It will be drawn themed if ThemesEnabled is True.
The GridDataBoundGrid registers "RowHeaderCell" as identifier in CellType of a cell's GridStyleInfo to associate this cell type with a cell.
The cell's behavior and appearance can be customized with the following properties of the GridStyleInfo class:
PropertyName | Description |
---|---|
BaseStyle (System.String) | The base style for this style instance with default values for properties that are not initialized for this style object. (Default: String.Empty) |
Borders (GridBordersInfo) | Top, left, bottom, and right border settings. (Default: GridBordersInfo.Default) |
CellAppearance (GridCellAppearance) | When set to Flat, the header will be drawn with slightly raised edges typical for cell headers. If the grid is XP Themes enabled, the headers will be drawn with XP Themes look. If you specify Sunken or Raised, the header will be drawn with sunken or raised edges and not XP Themed. (Default: GridCellAppearance.Flat) |
CellTipText (System.String) | ToolTip text to be displayed when user hovers mouse over cell. (Default: String.Empty) |
CellType (System.String) | RowHeaderCell (Default: TextBox) |
Enabled (System.Boolean) | Specifies if the cell can be activated as the current cell when the user clicks onto the header. Usually you do not want a header to be activated as the current cell unless you want to have editing capabilities like allowing user to rename header text in place. Such renaming functionality needs to be implemented in a derived class. (Default: true) |
Error (System.String) | Holds error information if a value could not be converted to the System.Type specified with CellValueType. (Default: String.Empty) |
Interior (BrushInfo) | Lets you specify a solid back color, gradient, or pattern style with both back and fore color for a cell's background. If the grid is XP Themes enabled, this color will be ignored and the header will be drawn with default XP Themes header background. (Default: SystemColors.Window) |
TextColor (System.Drawing.Color) | Lets you specify the color of the arrow, pencil, or star icon. (Default: SystemColors.WindowText) |
TextMargins (GridMarginsInfo) | When drawing this header cell this specifies the minimum empty area between the text rectangle without borders and the icon. The icon will be centered inside the remaining rectangle. (Default: GridMarginsInfo.Default) |
Themed (System.Boolean) | Specifies if cell should be drawn using Windows XP themes when ThemesEnabled has been set. (Default: True) |
Constructors
GridDataBoundRowHeaderCellRenderer(GridControlBase, GridCellModelBase)
Initializes a new GridCheckBoxCellRenderer object for the given GridControlBase and GridCellModelBase.
Declaration
public GridDataBoundRowHeaderCellRenderer(GridControlBase grid, GridCellModelBase cellModel)
Parameters
Type | Name | Description |
---|---|---|
GridControlBase | grid | The GridControlBase that displays this cell renderer. |
GridCellModelBase | cellModel | The GridCheckBoxCellModel that holds data for this cell renderer that should be shared among views. |
Remarks
References to GridControlBase and GridCellModelBase will be saved.
Methods
OnClick(Int32, Int32, MouseEventArgs)
This is called from GridSelectCellsMouseController when the user clicked inside a cell.
Declaration
protected override void OnClick(int rowIndex, int colIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
System.Windows.Forms.MouseEventArgs | e | A System.Windows.Forms.MouseEventArgs with data about the mouse event. |
Overrides
OnDraw(Graphics, Rectangle, Int32, Int32, GridStyleInfo)
This method is called from the cell renderer's draw method to draw the contents of the client bounds for the cell, e.g. the text for a static cell.
Declaration
protected override void OnDraw(Graphics g, Rectangle clientRectangle, int rowIndex, int colIndex, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | Points to the device context. |
System.Drawing.Rectangle | clientRectangle | Specifies the client rectangle. It is the cell rectangle without buttons and borders. |
System.Int32 | rowIndex | Specifies the row id. |
System.Int32 | colIndex | Specifies the column id. |
GridStyleInfo | style | A reference to the style object of the cell. |
Overrides
Remarks
When drawing cells, it is necessary to determine if the specified cell (with rowIndex and colIndex) is the current cell and if it is active.
If your control is associated with a control and supports in-place editing and the specified cell is the current cell, you should position the control. Take a look at the GridTextBoxCellRenderer implementation of this method for an example.
Otherwise, you can simply draw the cell.
OnDrawDisplayText(Graphics, Rectangle, Int32, Int32, GridStyleInfo)
This method is called from OnDraw(Graphics, Rectangle, Int32, Int32, GridStyleInfo) to draw the face text of the header cell after its background has been drawn.
Declaration
protected override void OnDrawDisplayText(Graphics g, Rectangle textRectangle, int rowIndex, int colIndex, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | Points to the device context. |
System.Drawing.Rectangle | textRectangle | Specifies the text rectangle. It is the cell rectangle without buttons, borders, or text margins. |
System.Int32 | rowIndex | Specifies the row id. |
System.Int32 | colIndex | Specifies the column id. |
GridStyleInfo | style | A reference to the style object of the cell. |
Overrides
PaintIcon(Graphics, Rectangle, Point, Bitmap, Color)
Paint the specified bitmap substituting black pixels with a new color.
Declaration
public static Rectangle PaintIcon(Graphics g, Rectangle bounds, Point offset, Bitmap bmp, Color foreColor)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | A Graphics object used to draw the bitmap. |
System.Drawing.Rectangle | bounds | A Rectangle which contains the boundary data of the rectangle. |
System.Drawing.Point | offset | A Point that specifies pixels to offset the bitmap from its origin point. |
System.Drawing.Bitmap | bmp | The Bitmap to be drawn on the screen. |
System.Drawing.Color | foreColor | The new color used to substitute black pixels. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | A Rectangle which contains the boundary data of the drawn bitmap. |
Remarks
The PaintIcon routine will substitute black pixels of the original bitmap and draw them with the specified fore color. The bitmap is centered inside the specified bounds. Use the offset if you want to display a "pressed button" state. If the button is pressed, specify offset = new Point(1, 1).
PaintIcon(Graphics, Rectangle, Point, String, Color)
Load the bitmap from manifest and paint it substituting black pixels with a new color.
Declaration
public static void PaintIcon(Graphics g, Rectangle bounds, Point offset, string bitmapName, Color foreColor)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | A Graphics object used to draw the bitmap. |
System.Drawing.Rectangle | bounds | A Rectangle which contains the boundary data of the rectangle. |
System.Drawing.Point | offset | A Point that specifies pixels to offset the bitmap from its origin point. |
System.String | bitmapName | The name of the bitmap. |
System.Drawing.Color | foreColor | The new color used to substitute black pixels. |
Remarks
The PaintIcon routine will substitute black pixels of the original bitmap and draw them with the specified fore color. The bitmap is centered inside the specified bounds. Use the offset if you want to display a "pressed button" state. If the button is pressed, specify offset = new Point(1, 1).