Class GridTableHeaderCellRenderer
Implements the renderer part of a column or row header.
Inheritance
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid.Grouping
Assembly: Syncfusion.Grid.Grouping.Windows.dll
Syntax
public class GridTableHeaderCellRenderer : GridStaticCellRenderer, IQueryFocusInside, IGridDropDownCell, IPopupParent, IPopupItem, IDisposable
Remarks
There can be several renderers. associated with one GridTableHeaderCellModel if several views display the same GridModel.
The header cell is XP Themes enabled. It will be drawn themed if ThemesEnabled is True.
The following table lists some characteristics about the Header cell type:
Item | Description |
---|---|
CellType | Header |
Renderer | GridTableHeaderCellRenderer |
Model | GridTableHeaderCellModel |
XP Themes Support | Yes |
Interactive | Click Only |
Floating Support | No |
Base Type | GridStaticCellRenderer |
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 an 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) | Header (Default: TextBox) |
CellValue (System.Object) | If empty, the standard header text will be drawn as specified with the NumberedRowHeaders and NumberedColHeaders properties in GridModel. If CellValue is not NULL, the cell value will be displayed as header text. (Default: String.Empty) |
CellValueType (System.Type) | Specifies the preferred System.Type for cell values. When you assign a value to the GridStyleInfo object, the value will be converted to this type. If the value cannot be converted, Error will contain error information. (Default: NULL) |
CultureInfo (System.Globalization.CultureInfo) | The culture information holds rules for parsing and formatting the cell's value. (Default: NULL) |
Enabled (System.Boolean) | Specifies if the header cell can be activated as current cell when the user clicks onto the header. Usually you do not want a header to be activated as current cell unless you want to have editing capabilities such as allowing the user to rename header text in place. (You would have to implement a custom header cell for this.) (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) |
Font (GridFontInfo) | The font for drawing text. (Default: GridFontInfo.Default) |
Format (System.String) | Gets or sets the format mask for formatting the cell value. You can specify numeric format strings, date format strings, or enumeration format strings as discussed in the section "Format Specifiers and Format Providers" of the .NET Framework Developers Guide (see ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconformatspecifiersformatproviders.htm) (Default: String.Empty) |
HorizontalAlignment (GridHorizontalAlignment) | Specifies horizontal alignment of text in the cell. (Default: GridHorizontalAlignment.Left) |
HotkeyPrefix (System.Drawing.Text.HotkeyPrefix) | Specifies how hot-key prefixes should be displayed. Hot-keys are indicated in text with an '&' (ampersand). When you enable a hot-key prefix, the specific characters can be displayed underlined or regular. The '&' will not be displayed. (Default: HotkeyPrefix.Show) |
ImageIndex (System.Int32) | Specifies an index for an image in the ImageList of a GridStyleInfo instance. (Default: -1) |
ImageList (System.Windows.Forms.ImageList) | The ImageList that holds a collection of images. Cells can choose images with the ImageIndex property in a GridStyleInfo instance. (Default: NULL) |
Interior (BrushInfo) | Lets you specify a solid backcolor, gradient, or pattern style with both back and forecolor for a cell's background. If 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) |
MergeCell (GridMergeCellDirection) | Specifies merge behavior for an individual cell when the merging cell's feature has been enabled in a GridModel with MergeCellsMode. (Default: GridMergeCellDirection.None) |
Text (System.String) | If empty, the standard header text will be drawn as specified with the NumberedRowHeaders and NumberedColHeaders properties in GridModel. If CellValue is not NULL, the cell value will be displayed as header text. (Default: String.Empty) |
TextColor (System.Drawing.Color) | Lets you specify the color for drawing the cell text. (Default: SystemColors.WindowText) |
TextMargins (GridMarginsInfo) | Holds text margins in pixels. When drawing a cell, this specifies the empty area between the text rectangle and the client rectangle of the cell without borders and cell buttons. (Default: GridMarginsInfo.Default) |
Themed (System.Boolean) | Specifies if cell should be drawn using Windows XP themes when ThemesEnabled has been set. (Default: True) |
Trimming (System.Drawing.StringTrimming) | Indicates how text is trimmed when it exceeds the edges of the cell text rectangle. (Default: StringTrimming.Character) |
VerticalAlignment (GridVerticalAlignment) | Specifies vertical alignment of text in the cell. (Default: GridVerticalAlignment.Top) |
WrapText (System.Boolean) | Specifies if text should be wrapped when it does not fit into a single line. (Default: True) |
Constructors
GridTableHeaderCellRenderer(GridControlBase, GridCellModelBase)
Initializes a new instance of the GridTableHeaderCellRenderer class for the given instance of the GridControlBase and GridCellModelBase classes.
Declaration
public GridTableHeaderCellRenderer(GridControlBase grid, GridCellModelBase cellModel)
Parameters
Type | Name | Description |
---|---|---|
GridControlBase | grid | The GridControlBase that displays this cell renderer. |
GridCellModelBase | cellModel | The GridCellModelBase that holds data for this cell renderer that should be shared among views. |
Remarks
References to GridControlBase and GridCellModelBase classes will be saved.
Methods
Dispose(Boolean)
Overrides and manages the unwanted resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | If True then the method call comes from the base Dispose method; Otherwise False indicating the method call comes from the finalizer. |
Overrides
OnCancelMode(Int32, Int32)
Declaration
protected override void OnCancelMode(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
Overrides
OnDraw(Graphics, Rectangle, Int32, Int32, GridStyleInfo)
Overrides and draws contents of the cell.
Declaration
protected override void OnDraw(Graphics g, Rectangle clientRectangle, int rowIndex, int colIndex, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The instance of the System.Drawing.Graphics class. |
System.Drawing.Rectangle | clientRectangle | Specifies the client rectangle. It is the cell rectangle without buttons and borders. |
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
GridStyleInfo | style | An instance of the GridStyleInfo that holds the values of style properties. |
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.
OnDrawCellBackground(GridDrawCellBackgroundEventArgs)
Override to draw the cell background.
Declaration
protected override void OnDrawCellBackground(GridDrawCellBackgroundEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridDrawCellBackgroundEventArgs | e | The GridDrawCellBackgroundEventArgs contains an event data. |
Overrides
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 virtual void OnDrawDisplayText(Graphics g, Rectangle textRectangle, int rowIndex, int colIndex, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The instance of the System.Drawing.Graphics class. |
System.Drawing.Rectangle | textRectangle | Specifies the text rectangle. It is the cell rectangle without buttons and borders and text margins. |
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
GridStyleInfo | style | An instance of the GridStyleInfo that holds the values of style properties. |
OnHitTest(Int32, Int32, MouseEventArgs, IMouseController)
Overrides and called to determine whether the cell renderer wants to receive mouse events for the give cell at the given coordinates.
Declaration
protected override int OnHitTest(int rowIndex, int colIndex, MouseEventArgs e, IMouseController controller)
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 contains the event data. |
IMouseController | controller | The IMouseController that handles the mouse events. |
Returns
Type | Description |
---|---|
System.Int32 | Non-zero hit context value if you request to handle the mouse event; zero if you vote not to handle the mouse event. |
Overrides
OnMouseDown(Int32, Int32, MouseEventArgs)
Overrides and triggered when the System.Windows.Forms.Control.MouseDown event is done.
Declaration
protected override void OnMouseDown(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 | The System.Windows.Forms.MouseEventArgs contains the event data. |
Overrides
OnMouseHover(Int32, Int32, MouseEventArgs)
Overrides and triggered when the System.Windows.Forms.Control.MouseHover event is done.
Declaration
protected override void OnMouseHover(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 | The System.Windows.Forms.MouseEventArgs contains the event data. |
Overrides
OnMouseHoverLeave(Int32, Int32, EventArgs)
Overrides and triggered when the OnMouseHoverLeave(Int32, Int32, EventArgs) event is done.
Declaration
protected override void OnMouseHoverLeave(int rowIndex, int colIndex, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
System.EventArgs | e | The System.Windows.Forms.MouseEventArgs contains the event data.. |
Overrides
OnMouseMove(Int32, Int32, MouseEventArgs)
Overrides and triggered when the System.Windows.Forms.Control.MouseMove event is done.
Declaration
protected override void OnMouseMove(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 | The System.Windows.Forms.MouseEventArgs contains the event data. |
Overrides
OnMouseUp(Int32, Int32, MouseEventArgs)
Overrides and triggered when the System.Windows.Forms.Control.MouseUp event is done.
Declaration
protected override void OnMouseUp(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 | The System.Windows.Forms.MouseEventArgs contains the event data. |
Overrides
OnOutlineCurrentCell(Graphics, Rectangle)
Overrides and highlights the current cell by inverting the cells border or drawing a thick border.
Declaration
protected override void OnOutlineCurrentCell(Graphics g, Rectangle r)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The instance of the System.Drawing.Graphics class. |
System.Drawing.Rectangle | r | The instance of the System.Drawing.Rectangle that specifies the cell rectangle values. |
Overrides
Remarks
This method handles the default highlighting. of your cell.
OnPrepareViewStyleInfo(GridPrepareViewStyleInfoEventArgs)
Allows custom formatting of a cell by changing its style object.
Declaration
public override void OnPrepareViewStyleInfo(GridPrepareViewStyleInfoEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridPrepareViewStyleInfoEventArgs | e | Event data. |
Overrides
UnwireGrid()
UnWire the grid.
Declaration
protected virtual void UnwireGrid()
WireGrid()
Wires the grid.
Declaration
protected virtual void WireGrid()