Class GridCellRendererBase
Represents the base class for the cell renderer that used to draw the cell.
Inheritance
Inherited Members
Namespace: Syncfusion.WinForms.DataGrid.Renderers
Assembly: Syncfusion.SfDataGrid.WinForms.dll
Syntax
public class GridCellRendererBase : IGridCellRenderer<TableControl>, IDisposable
Constructors
GridCellRendererBase()
Initializes a new instance of the GridCellRendererBase class.
Declaration
public GridCellRendererBase()
Properties
CurrentCellIndex
Gets the current cell's row column index.
Declaration
public RowColumnIndex CurrentCellIndex { get; }
Property Value
Type |
---|
RowColumnIndex |
CurrentCellRendererElement
Gets the editor control of the current cell.
Declaration
public Control CurrentCellRendererElement { get; }
Property Value
Type |
---|
System.Windows.Forms.Control |
HasCurrentCellState
Gets a value indicating whether the current cell state is maintained or not.
Declaration
public bool HasCurrentCellState { get; }
Property Value
Type |
---|
System.Boolean |
IsEditable
Gets or sets a value indicating whether the cell is editable or not.
Declaration
public bool IsEditable { get; set; }
Property Value
Type |
---|
System.Boolean |
IsFocusable
Gets or sets a value indicating whether the cell is focusable or not.
Declaration
public bool IsFocusable { get; set; }
Property Value
Type |
---|
System.Boolean |
IsFocused
Gets or sets a value indicating whether the editor control of current cell is focused or not.
Declaration
public bool IsFocused { get; set; }
Property Value
Type |
---|
System.Boolean |
IsHovered
Gets or sets a value indicating whether the mouse is hovered on the cell or not.
Declaration
protected bool IsHovered { get; set; }
Property Value
Type |
---|
System.Boolean |
IsInEditing
Gets or sets a value indicating whether the editor control of current cell is in editing or not.
Declaration
public bool IsInEditing { get; set; }
Property Value
Type |
---|
System.Boolean |
IsPressed
Gets or sets a value indicating whether the mouse button is pressed on the cell or not.
Declaration
protected bool IsPressed { get; set; }
Property Value
Type |
---|
System.Boolean |
TableControl
Gets or sets the TableControl of the cell.
Declaration
public TableControl TableControl { get; set; }
Property Value
Type |
---|
TableControl |
Methods
BeginEdit(DataColumnBase, RowColumnIndex)
Begins the editing of the cell with editor control.
Declaration
public virtual bool BeginEdit(DataColumnBase column, RowColumnIndex cellRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | column | The DataColumnBase. |
RowColumnIndex | cellRowColumnIndex | The current cell row and column index. |
Returns
Type | Description |
---|---|
System.Boolean | Returns the result of current cell begin editing. |
CanValidate()
Indicates whether the current cell can be validated or not.
Declaration
public virtual bool CanValidate()
Returns
Type | Description |
---|---|
System.Boolean | Returns the value indicating whether the current cell can be validated or not. |
Dispose()
Disposes of the resources used by the GridCellRendererBase.
Declaration
public void Dispose()
Dispose(Boolean)
Disposes all the resources used by the GridCellRendererBase class.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | Indicates the call is from Dispose method. |
DrawErrorIcon(Graphics, Rectangle, Bitmap, RowColumnIndex)
Draws the error icon.
Declaration
public void DrawErrorIcon(Graphics graphics, Rectangle iconRect, Bitmap errorIcon, RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | graphics | The System.Drawing.Graphics that used to draw the error icon. |
System.Drawing.Rectangle | iconRect | The rectangle for the error icon. |
System.Drawing.Bitmap | errorIcon | The bitmap of the error icon. |
RowColumnIndex | rowColumnIndex | The row and column index. |
EndEdit(DataColumnBase, RowColumnIndex)
Ends the editing of the cell.
Declaration
public virtual bool EndEdit(DataColumnBase column, RowColumnIndex cellRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | column | The DataColumnBase. |
RowColumnIndex | cellRowColumnIndex | The current cell row and column index. |
Returns
Type | Description |
---|---|
System.Boolean | Returns the result of the end editing of the cell. |
GetCellValue()
Gets the cell value of the current cell.
Declaration
protected virtual string GetCellValue()
Returns
Type | Description |
---|---|
System.String | Returns the cell value of the current cell. |
GetControlValue()
Gets the control value of the editor control.
Declaration
public virtual object GetControlValue()
Returns
Type | Description |
---|---|
System.Object | The value of the editor control. |
GetEditorUIElementBounds()
Gets the bounds for the editor control.
Declaration
protected virtual Rectangle GetEditorUIElementBounds()
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | Returns the bound rectangle for the editor control. |
KeyDown(DataColumnBase, RowColumnIndex, KeyEventArgs)
Occurs when the key is pressed while the cell has focus.
Declaration
public void KeyDown(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |
System.Windows.Forms.KeyEventArgs | e | The System.Windows.Forms.KeyEventArgs that contains the event data. |
KeyPress(DataColumnBase, RowColumnIndex, KeyPressEventArgs)
Occurs when the key is pressed while the cell has focus.
Declaration
public void KeyPress(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, KeyPressEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |
System.Windows.Forms.KeyPressEventArgs | e | The System.Windows.Forms.KeyEventArgs that contains the event data. |
KeyUp(DataColumnBase, RowColumnIndex, KeyEventArgs)
Occurs when the key is released while the cell has focus.
Declaration
public void KeyUp(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |
System.Windows.Forms.KeyEventArgs | e | The System.Windows.Forms.KeyEventArgs that contains the event data. |
MouseDoubleClick(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when the mouse button is double clicked on the cell.
Declaration
public void MouseDoubleClick(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The RowColumnIndex of the cell. |
System.Windows.Forms.MouseEventArgs | e | The System.Windows.Forms.MouseEventArgs contains the event data. |
MouseDown(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when the mouse pointer is over the cell and a mouse button is pressed.
Declaration
public void MouseDown(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |
System.Windows.Forms.MouseEventArgs | e | The System.Windows.Forms.MouseEventArgs contains the event data. |
MouseHover(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when the mouse pointer rests on the cell.
Declaration
public void MouseHover(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |
System.Windows.Forms.MouseEventArgs | e | The System.Windows.Forms.MouseEventArgs contains the event data. |
MouseHoverLeave(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when the mouse leaves the cell.
Declaration
public void MouseHoverLeave(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | RowColumnIndex of the cell from which the mouse leaves. |
System.Windows.Forms.MouseEventArgs | e | The System.Windows.Forms.MouseEventArgs contains the event data. |
MouseMove(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when the mouse pointer is moved over the cell.
Declaration
public void MouseMove(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |
System.Windows.Forms.MouseEventArgs | e | The System.Windows.Forms.MouseEventArgs contains the event data. |
MouseUp(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when the mouse pointer is over on the cell and a mouse button is released.
Declaration
public void MouseUp(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The RowColumnIndex of the cell. |
System.Windows.Forms.MouseEventArgs | e | The System.Windows.Forms.MouseEventArgs contains the event data. |
OnDrawCurrentCell(Graphics, SfDataGrid, RowColumnIndex)
Draw the current cell with the given values.
Declaration
protected virtual void OnDrawCurrentCell(Graphics graphics, SfDataGrid dataGrid, RowColumnIndex currentCellRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | graphics | The System.Drawing.Graphics that used to draw the cell. |
SfDataGrid | dataGrid | The corresponding SfDataGrid |
RowColumnIndex | currentCellRowColumnIndex | The corresponding row column index of the current cell. |
OnDrawErrorIcon(Graphics, Rectangle, Bitmap, RowColumnIndex)
Occurs when drawing the error icon of the cell.
Declaration
protected virtual void OnDrawErrorIcon(Graphics graphics, Rectangle iconRect, Bitmap errorIcon, RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | graphics | The System.Drawing.Graphics that used to draw the error icon. |
System.Drawing.Rectangle | iconRect | The rectangle for the error icon. |
System.Drawing.Bitmap | errorIcon | The bitmap of the error icon. |
RowColumnIndex | rowColumnIndex | The row and column index. |
OnKeyDown(DataColumnBase, RowColumnIndex, KeyEventArgs)
Occurs when the key is pressed while the cell has focus.
Declaration
protected virtual void OnKeyDown(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |
System.Windows.Forms.KeyEventArgs | e | The System.Windows.Forms.KeyEventArgs that contains the event data. |
OnKeyPress(DataColumnBase, RowColumnIndex, KeyPressEventArgs)
Occurs when the key is pressed while the cell has focus.
Declaration
protected virtual void OnKeyPress(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, KeyPressEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |
System.Windows.Forms.KeyPressEventArgs | e | The System.Windows.Forms.KeyEventArgs that contains the event data. |
OnKeyUp(DataColumnBase, RowColumnIndex, KeyEventArgs)
Occurs when the key is released while the cell has focus.
Declaration
protected virtual void OnKeyUp(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |
System.Windows.Forms.KeyEventArgs | e | The System.Windows.Forms.KeyEventArgs that contains the event data. |
OnMouseDoubleClick(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when the mouse button is double clicked on the cell.
Declaration
protected virtual void OnMouseDoubleClick(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | RowColumnIndex of the cell. |
System.Windows.Forms.MouseEventArgs | e | The System.Windows.Forms.MouseEventArgs contains the event data. |
OnMouseDown(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when the mouse pointer is over the cell and a mouse button is pressed.
Declaration
protected virtual void OnMouseDown(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |
System.Windows.Forms.MouseEventArgs | e | The System.Windows.Forms.MouseEventArgs contains the event data. |
OnMouseHover(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when the mouse pointer rests on the cell.
Declaration
protected virtual void OnMouseHover(DataColumnBase column, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | column | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |
System.Windows.Forms.MouseEventArgs | e | The System.Windows.Forms.MouseEventArgs contains the event data. |
OnMouseHoverLeave(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when the mouse leaves the cell.
Declaration
protected virtual void OnMouseHoverLeave(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | RowColumnIndex of the cell from which the mouse leaves. |
System.Windows.Forms.MouseEventArgs | e | The System.Windows.Forms.MouseEventArgs contains the event data. |
OnMouseMove(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when the mouse pointer is moved over the cell.
Declaration
protected virtual void OnMouseMove(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |
System.Windows.Forms.MouseEventArgs | e | The System.Windows.Forms.MouseEventArgs contains the event data. |
OnMouseUp(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when the mouse pointer is over on the cell and a mouse button is released.
Declaration
protected virtual void OnMouseUp(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The RowColumnIndex of the cell. |
System.Windows.Forms.MouseEventArgs | e | The System.Windows.Forms.MouseEventArgs contains the event data. |
OnRender(Graphics, Rectangle, String, CellStyleInfo, DataColumnBase, RowColumnIndex)
Occurs when the cell is need to be drawn.
Declaration
protected virtual void OnRender(Graphics paint, Rectangle cellRect, string cellValue, CellStyleInfo style, DataColumnBase column, RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | paint | The System.Drawing.Graphics that used to draw the cell. |
System.Drawing.Rectangle | cellRect | The bounds of the cell. |
System.String | cellValue | The value of the cell. |
CellStyleInfo | style | The CellStyleInfo of the cell. |
DataColumnBase | column | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |
OnUpdateEditElement(DataColumnBase, Control, Rectangle)
Updates the editor element of the cell.
Declaration
protected virtual Rectangle OnUpdateEditElement(DataColumnBase column, Control element, Rectangle rect)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | column | The DataColumnBase. |
System.Windows.Forms.Control | element | The editor element. |
System.Drawing.Rectangle | rect | The editor bounds. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | Returns the rectangle reduced from the editor bounds. |
Render(Graphics, Rectangle, String, CellStyleInfo, DataColumnBase, RowColumnIndex)
Renderer the cell with the given values.
Declaration
public void Render(Graphics paint, Rectangle cellRect, string cellValue, CellStyleInfo style, DataColumnBase column, RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | paint | The System.Drawing.Graphics that used to draw the cell. |
System.Drawing.Rectangle | cellRect | The bounds of the cell. |
System.String | cellValue | The value of the cell. |
CellStyleInfo | style | The CellStyleInfo of the cell. |
DataColumnBase | column | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The Row and column index of the cell. |
ResetCurrentCellState()
Resets the current cell state.
Declaration
public void ResetCurrentCellState()
SetControlValue(Object)
Sets the value for the editor control.
Declaration
public virtual void SetControlValue(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value of the editor control. |
SetCurrentCellState(RowColumnIndex, Control, Boolean, Boolean)
Sets the current cell state.
Declaration
public void SetCurrentCellState(RowColumnIndex currentCellIndex, Control currentCellElement, bool isInEditing, bool isFocused)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | currentCellIndex | The current cell row and column index. |
System.Windows.Forms.Control | currentCellElement | The editor control of the current cell. |
System.Boolean | isInEditing | The value indicating whether the cell is in editing or not. |
System.Boolean | isFocused | The value indicating whether the cell is focused or not. |
SetFocus(Boolean)
Sets the focus to the editor control or the grid.
Declaration
public void SetFocus(bool needToFocus)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | needToFocus | Value indicating whether to focus the editing control or not. |
SetFocus(Control, Boolean)
Sets the focus to the editor control.
Declaration
protected virtual void SetFocus(Control uiElement, bool needToFocus)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | uiElement | The editor control of the cell. |
System.Boolean | needToFocus | The value indicating whether to set focus for editor control or not. |
ShowValidationErrorToolTip(SfToolTip, DataColumnBase, RowColumnIndex, Point)
Shows the validation error tooltip.
Declaration
protected virtual void ShowValidationErrorToolTip(SfToolTip sfToolTip, DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, Point location)
Parameters
Type | Name | Description |
---|---|---|
SfToolTip | sfToolTip | The |
DataColumnBase | dataColumn | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The RowColumnIndex of the cell. |
System.Drawing.Point | location | The location in which the tooltip is to be shown. |
UnloadUIElement()
Unloads the editor control of the current cell.
Declaration
public void UnloadUIElement()
UpdateCurrentCellState(Control, Boolean)
Updates the state of the current cell.
Declaration
protected void UpdateCurrentCellState(Control currentRendererElement, bool isInEdit)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | currentRendererElement | The editor control of the cell. |
System.Boolean | isInEdit | The value indicating whether the cell is in edit state or not. |
UpdateEditElement(DataColumnBase, Control, Rectangle)
Updates the editor element of the cell.
Declaration
public Rectangle UpdateEditElement(DataColumnBase column, Control element, Rectangle rect)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | column | The DataColumnBase. |
System.Windows.Forms.Control | element | The editor element. |
System.Drawing.Rectangle | rect | The editor bounds. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | Returns the rectangle adjusted with the editor bounds. |
Explicit Interface Implementations
IGridCellRenderer<TableControl>.OnDrawCurrentCell(Graphics, SfDataGrid, RowColumnIndex)
Draw the current cell with the given values.
Declaration
void IGridCellRenderer<TableControl>.OnDrawCurrentCell(Graphics graphics, SfDataGrid dataGrid, RowColumnIndex currentCellRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | graphics | The System.Drawing.Graphics that used to draw the cell. |
SfDataGrid | dataGrid | The corresponding SfDataGrid |
RowColumnIndex | currentCellRowColumnIndex | The corresponding row column index of the current cell. |