Class GridRadioButtonCellRenderer
Implements the renderer part of a radio button cell.
Inheritance
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public class GridRadioButtonCellRenderer : GridStaticCellRenderer, IQueryFocusInside, IGridDropDownCell, IPopupParent, IPopupItem, IDisposable
Remarks
You set up radio buttons using an array of
GridRadioButtonInfo objects. Each info object in this
array corresponds to a single radio button. The properties for each button
that you can set include GridRadioButtonInfo.Description,
GridRadioButtonInfo.Alignment and GridRadioButtonInfo.Enabled. To get a
cell to use a particular GridRadioButtonInfo[], you set the
GridStyleInfo.ChoiceList to string collection that holds the descriptions for
each button. If you want to disable a particular button, end the description
with /disabled. You are limited to a maximum of ten buttons. The alignment setting
is determined from the GridStyleInfo.TextAlign property.
Constructors
GridRadioButtonCellRenderer(GridControlBase, GridCellModelBase)
Initializes a new GridRadioButtonCellRenderer object for the given GridControlBase and GridCellModelBase.
Declaration
public GridRadioButtonCellRenderer(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 will be saved.
Methods
Draw(Graphics, Rectangle, Int32, Int32, GridStyleInfo)
Draw the contents of specified cell.
Declaration
public override void Draw(Graphics g, Rectangle cellRectangle, int rowIndex, int colIndex, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | Graphics context. |
System.Drawing.Rectangle | cellRectangle | Cell rectangle. |
System.Int32 | rowIndex | Row index. |
System.Int32 | colIndex | Column index. |
GridStyleInfo | style | Cell style information. |
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.
OnInitialize(Int32, Int32)
This method gets called from the cell renderer's initialize method. Override this method if you need to any initialization for the current cell.
Declaration
protected override void OnInitialize(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
Overrides
OnKeyDown(KeyEventArgs)
User pressed key down (similar to Control.OnKeyDown).
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.KeyEventArgs | e | The System.Windows.Forms.KeyEventArgsthat contains event data. |
Overrides
OnLayout(Int32, Int32, GridStyleInfo, Rectangle, Rectangle[])
This method is called from PerformLayout to calculate the client rectangle given the inner rectangle of a cell and any boundaries of cell buttons.
Declaration
protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
System.Drawing.Rectangle | innerBounds | The System.Drawing.Rectangle with the inner bounds of a cell. |
System.Drawing.Rectangle[] | buttonsBounds | An array of System.Drawing.Rectangle with bounds for each cell button element. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | A System.Drawing.Rectangle with the bounds. |
Overrides
OnQueryShowButtons(Int32, Int32, GridStyleInfo)
Overridden to allow buttons to be printed.
Declaration
protected override bool OnQueryShowButtons(int rowIndex, int colIndex, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
Returns
Type | Description |
---|---|
System.Boolean | returns Boolean value |
Overrides
OnSaveChanges()
This method is called from GridCurrentCell.ConfirmChanges when the current cell was marked as modified. Any drop-downs have been closed at this time. It saves changes for the current cell.
Declaration
protected override bool OnSaveChanges()
Returns
Type | Description |
---|---|
System.Boolean | True if changes were saved successfully; False if no changes were saved. |