Class GridButtonCellRenderer
Represents a class that used for drawing a button in a cell.
Inherited Members
Namespace: Syncfusion.WinForms.DataGrid.Renderers
Assembly: Syncfusion.SfDataGrid.WinForms.dll
Syntax
public class GridButtonCellRenderer : GridCellRendererBase, IGridCellRenderer<TableControl>, IDisposable
Examples
The following example shows how to add the custom cell button renderer.
// Remove the existing button cell renderer and added the custom button cell renderer.
sfDataGrid1.CellRenderers.Remove("ButtonEdit");
sfDataGrid1.CellRenderers.Add("ButtonEdit", new CustomCellButtonRenderer());
// Implementation for custom button cell renderer.
public class CustomCellButtonRenderer : GridButtonCellRenderer
{
public CustomCellButtonRenderer()
{
}
protected override void OnKeyDown(DataColumnBase dataColumn, RowColumnIndex rowColumnIndex, KeyEventArgs e)
{
if (e.KeyCode == Keys.Space)
{
// To avoid the button click using the Space key.
return;
}
base.OnKeyDown(dataColumn, rowColumnIndex, e);
}
}
Constructors
GridButtonCellRenderer()
Initializes a new instance of the GridButtonCellRenderer class.
Declaration
public GridButtonCellRenderer()
Methods
OnKeyDown(DataColumnBase, RowColumnIndex, KeyEventArgs)
Overridden to update the key down on the filter row cell.
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 column index of the cell. |
System.Windows.Forms.KeyEventArgs | e | An System.Windows.Forms.KeyEventArgs that contains event data. |
Overrides
OnMouseDown(DataColumnBase, RowColumnIndex, MouseEventArgs)
Overridden to update the CellButton while performing the mouse down.
Declaration
protected override void OnMouseDown(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 | An System.Windows.Forms.MouseHoverEventArgs that contains event data. |
Overrides
OnMouseHoverLeave(DataColumnBase, RowColumnIndex, MouseEventArgs)
Overridden to update the previous cell on mouse hover leave is occurs.
Declaration
protected override void OnMouseHoverLeave(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 | An System.Windows.Forms.MouseHoverEventArgs that contains event data. |
Overrides
OnMouseMove(DataColumnBase, RowColumnIndex, MouseEventArgs)
Overridden to update the mouse hovering location on the cell.
Declaration
protected override void OnMouseMove(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 | An System.Windows.Forms.MouseHoverEventArgs that contains event data. |
Overrides
OnMouseUp(DataColumnBase, RowColumnIndex, MouseEventArgs)
Overridden to update the MouseUp operation on the CellButton.
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 | An System.Windows.Forms.MouseHoverEventArgs that contains event data. |
Overrides
OnRender(Graphics, Rectangle, String, CellStyleInfo, DataColumnBase, RowColumnIndex)
Overridden to renderer the button 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 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. |