Class GridCheckBoxCellRenderer
Represents the class that used for drawing the check box cell.
Inheritance
Inherited Members
Namespace: Syncfusion.WinForms.DataGrid.Renderers
Assembly: Syncfusion.SfDataGrid.WinForms.dll
Syntax
public class GridCheckBoxCellRenderer : GridCellRendererBase, IGridCellRenderer<TableControl>, IDisposable
Examples
The following example shows how to replace the custom check box cell renderer with existing check box cell renderer.
// Remove the existing check box cell renderer and added the custom check box cell renderer.
sfDataGrid1.CellRenderers.Remove("CheckBox");
sfDataGrid1.CellRenderers.Add("CheckBox", new CustomCheckBoxRenderer());
// Implementation for custom check box renderer.
public class CustomCheckBoxRenderer : GridCheckBoxCellRenderer
{
public CustomCheckBoxRenderer()
{
}
protected override void OnKeyDown(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, KeyEventArgs e)
{
if (e.KeyCode == Keys.Space)
{
// To avoid changing state of the check box on Space key.
return;
}
base.OnKeyDown(dataColumn, rowColumnIndex, e);
}
}
Constructors
GridCheckBoxCellRenderer()
Initializes a new instance of the GridCheckBoxCellRenderer class.
Declaration
public GridCheckBoxCellRenderer()
Methods
GetControlValue()
Overridden to get the control value.
Declaration
public override object GetControlValue()
Returns
Type | Description |
---|---|
System.Object | Returns the control value. |
Overrides
OnKeyDown(DataColumnBase, RowColumnIndex, KeyEventArgs)
Occurs when the key is pressed while the cell has focus.
Declaration
protected override 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. |
Overrides
OnMouseHoverLeave(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when the mouse leaves the check box cell.
Declaration
protected override void OnMouseHoverLeave(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The DataColumnBase of the check box cell. |
RowColumnIndex | rowColumnIndex | RowColumnIndex of the check box cell from which the mouse leaves. |
System.Windows.Forms.MouseEventArgs | e | The System.Windows.Forms.MouseEventArgs contains the event data. |
Overrides
OnMouseMove(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when the mouse pointer rests on the check box cell.
Declaration
protected override void OnMouseMove(DataColumnBase column, RowColumnIndex rowColumnIndex, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | column | The DataColumnBase of the check box cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the check box cell. |
System.Windows.Forms.MouseEventArgs | e | The System.Windows.Forms.MouseEventArgs contains the event data. |
Overrides
OnMouseUp(DataColumnBase, RowColumnIndex, MouseEventArgs)
Occurs when the mouse pointer is over on the cell and a mouse button is released.
Declaration
protected override 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. |
Overrides
OnRender(Graphics, Rectangle, String, CellStyleInfo, DataColumnBase, RowColumnIndex)
Overridden to draw the check box of the cell.
Declaration
protected override 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 check box. |
System.Drawing.Rectangle | cellRect | The cell rectangle. |
System.String | cellValue | The cell value. |
CellStyleInfo | style | The CellStyleInfo of the cell. |
DataColumnBase | column | The DataColumnBase of the cell. |
RowColumnIndex | rowColumnIndex | The row and column index of the cell. |