Class GridRichControlEditCellRenderer
Implements the renderer part of a generic control cell.
Inheritance
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public class GridRichControlEditCellRenderer : GridStaticCellRenderer, IQueryFocusInside, IGridDropDownCell, IPopupParent, IPopupItem, IDisposable
Remarks
Use the Control property to associate any windows forms control with this cell type.
Be careful when sharing this cell type among several cells. In most cases, it will cause problems and you should assign a different control to each cell's Control
GridRichControlEditCellRenderer is derived from GridStaticCellRenderer. It adds support for embedding any custom .NET control inside a cell. But if you want to draw the content of the cell yourself, deriving from GridStaticCellRenderers and overriding its OnDraw method should be enough.
See the SliderCells, WebBrowserCells, and PictureBoxCells for samples of this cell type.
The following table lists some characteristics about the Control cell type:
Item | Description |
---|---|
CellType | Control |
Renderer | GridRichControlEditCellRenderer |
Model | GridRichControlEditCellModel |
XP Themes Support | NA |
Interactive | Depends on embedded control |
Control | System.Windows.Forms.Control |
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) | Specifies if cell edges shall be drawn raised, sunken, or flat (default). (Default: GridCellAppearance.Flat) |
CellTipText (System.String) | ToolTip text to be displayed when user hovers mouse over cell. (Default: String.Empty) |
CellType (System.String) | Control (Default: Text Box) |
CellValue (System.Object) | This property holds the cell value. Although the cell value is typically a string, it can also be any other primitive type such as int, byte, enum, or any custom type that is derived from System.Object. (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) |
Control (System.Windows.Forms.Control) | A custom control you can associate with a cell. (Default: NULL) |
Enabled (System.Boolean) | Specifies if the cell can be activated as current cell or if the cell should be skipped when moving the current cell. (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) |
Interior (BrushInfo) | Lets you specify a solid backColor, gradient, or pattern style with both back and foreColor for a cells background. (Default: SystemColors.Window) |
ReadOnly (System.Boolean) | Specifies if cell contents can be modified by the user. You can programatically change Read-only cells by setting DiscardReadOnly to True. (Default: False) |
Constructors
GridRichControlEditCellRenderer(GridControlBase, GridCellModelBase)
Initializes a new GridRichControlEditCellRenderer object for the given GridControlBase and GridCellModelBase.
Declaration
public GridRichControlEditCellRenderer(GridControlBase grid, GridCellModelBase cellModel)
Parameters
Type | Name | Description |
---|---|---|
GridControlBase | grid | The GridControlBase that display 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.
Properties
PassedControl
Gets or sets the value of control to the passedControl.
Declaration
public Control PassedControl { get; set; }
Property Value
Type |
---|
System.Windows.Forms.Control |
Methods
ControlLostFocus(Object, EventArgs)
Used to change the behavior of the ControlLostFocus event
Declaration
protected override void ControlLostFocus(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | Represents the root of the hierarchy |
System.EventArgs | e | provides the value to use for events |
Overrides
DrawCellAppearance(Graphics, Rectangle, GridStyleInfo)
Used to change the behavior of the DrawCellAppearance event
Declaration
protected override void DrawCellAppearance(Graphics g, Rectangle rect, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | Represents the GDI+ surfaces |
System.Drawing.Rectangle | rect | Represents the location and size of the rectangle |
GridStyleInfo | style | Used to store all the information of the cell |
Overrides
FixControlParent(Control)
Parents the control to the grid instance and ensures correct settings for Systems.Windows.Forms.Control.CausesValidation, Systems.Windows.Forms.Control.Anchor, and Systems.Windows.Forms.Control.Dock.
Declaration
protected void FixControlParent(Control control)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control | The control that is shown in this cell. |
Hide()
Hides the control.
Declaration
public override void Hide()
Overrides
OnActivated()
Used to change the behavior of the OnActivated event
Declaration
protected override void OnActivated()
Overrides
OnActivating(Int32, Int32)
This is called from GridCurrentCell.Activate after the activating event has been raised and allows interception of cell activation.
Declaration
protected override bool OnActivating(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
Returns
Type | Description |
---|---|
System.Boolean | True is cell can be activated; False otherwise. |
Overrides
OnButtonClicked(Int32, Int32, Int32)
Used to change the behavior of the OnButtonClicked event
Declaration
protected override void OnButtonClicked(int rowIndex, int colIndex, int button)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | used to get the row value of the cell |
System.Int32 | colIndex | used to get the column value of the cell |
System.Int32 | button | used to get the button value |
Overrides
OnCellLayoutChanged()
Used to change the behavior of the CellLayout event
Declaration
protected override void OnCellLayoutChanged()
Overrides
OnClick(Int32, Int32, MouseEventArgs)
This is called from GridSelectCellsMouseController when the user clicked inside a cell.
Declaration
protected override void OnClick(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 | A System.Windows.Forms.MouseEventArgs with data about the mouse event. |
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.
OnEditingComplete()
Used to change the behavior of the OnEditingComplete event
Declaration
protected override void OnEditingComplete()
Overrides
OnHasFocusControlChanged()
Override this method if your cell renderer supports in-place editing and you want to do any custom initialization at this point before cell gets redrawn.
Declaration
protected override void OnHasFocusControlChanged()
Overrides
Remarks
The default behavior of this virtual method is to force a redraw of the current cell. A cell can then initialize an edit control and set focus in the OnDraw method call.
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
OnScrollInView(GridScrollCurrentCellReason)
Used to change the behavior of the scroll into view
Declaration
public override bool OnScrollInView(GridScrollCurrentCellReason reason)
Parameters
Type | Name | Description |
---|---|---|
GridScrollCurrentCellReason | reason | The GridScrollCurrentCellReason provides the value to use for events |
Returns
Type |
---|
System.Boolean |
Overrides
PanelCancel(Object, EventArgs)
Event handler for the Cancel event of the GridRichTextEntryPanel.
Declaration
protected virtual void PanelCancel(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The source of the event. |
System.EventArgs | e | The System.EventArgsthat contains event data. |
PanelSave(Object, EventArgs)
Event handler for the Save event of the GridRichTextEntryPanel.
Declaration
protected virtual void PanelSave(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The source of the event. |
System.EventArgs | e | The System.EventArgsthat contains event data. |
ShouldRefreshCurrentCell()
Used to change the behavior of the ShouldRefreshCurrentCell event
Declaration
public override bool ShouldRefreshCurrentCell()
Returns
Type |
---|
System.Boolean |