Class GridRichTextBoxCellRenderer
Implements the renderer part of a rich text cell.
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public class GridRichTextBoxCellRenderer : GridCellRendererBase, IQueryFocusInside, IGridDropDownCell, IPopupParent, IPopupItem, IDisposable
Remarks
Use "RichText" as identifier in CellType of a cells GridStyleInfo to associate this cell type with a cell.
This renderer supports editing the contents of the rich text with a drop-down panel. When the user drops the panel, a GridRichTextEntryPanel is shown and the user can format the text and then accept changes by pressing "Save" button.
The following table lists some characteristics about the RichText cell type.
Item | Description |
---|---|
CellType | RichText |
Renderer | GridRichTextBoxCellRenderer |
Model | GridRichTextBoxCellModel |
XP Themes Support | Yes |
Interactive | Edit with DropDown Panel |
DropDown Control | GridRichTextEntryPanel |
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) | RichText (Default: TextBox) |
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) |
Clickable (System.Boolean) | Specifies if the user can click on any cell button elements in this renderer. (Default: True) |
CultureInfo (System.Globalization.CultureInfo) | The culture information holds rules for parsing and formatting the cell's value. (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 cell's background. (Default: SystemColors.Window) |
ReadOnly (System.Boolean) | Specifies if cell contents can be modified by the user. You can programmatically change Read-only cells by setting DiscardReadOnly to True. (Default: False) |
ShowButtons (GridShowButtons) | Specifies when to show or display the cell buttons. Possible choices are: show the button only for the current cell, always show buttons, or never show buttons. (Default: GridShowButtons.Show) |
Text (System.String) | Gets / sets the value as a string. If a CellValueType is specified, the text will be parsed and converted to the type specified with CellValueType using any CultureInfo information. (Default: String.Empty) |
Themed (System.Boolean) | Specifies if cell should be drawn using Windows XP themes when ThemesEnabled has been set. (Default: True) |
ValidateValue (GridCellValidateValueInfo) | Holds validation rules for the cell value that are being checked before any user changes are committed to the grid cell's style object. (Default: NULL) |
Constructors
GridRichTextBoxCellRenderer(GridControlBase, GridCellModelBase)
Initializes a new GridRichTextBoxCellRenderer object for the given GridControlBase and GridCellModelBase.
Declaration
public GridRichTextBoxCellRenderer(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.
Properties
DropDownContainer
Gets the container where you can insert child controls to be displayed as drop-down part for your cell.
Declaration
public GridDropDownContainer DropDownContainer { get; }
Property Value
Type |
---|
GridDropDownContainer |
Methods
DropDownContainerCloseDropDown(Object, PopupClosedEventArgs)
Will be called to indicate that the popup child was closed.
Declaration
public override void DropDownContainerCloseDropDown(object sender, PopupClosedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The child that was closed. |
PopupClosedEventArgs | e | The event data with a PopupCloseType value. |
Overrides
DropDownContainerShowedDropDown(Object, EventArgs)
Occurs after the popup has been dropped-down and made visible.
Declaration
public override void DropDownContainerShowedDropDown(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. |
Overrides
DropDownContainerShowingDropDown(Object, CancelEventArgs)
Occurs when the drop-down container is about to be shown.
Declaration
public override void DropDownContainerShowingDropDown(object sender, CancelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The source of the event. |
System.ComponentModel.CancelEventArgs | e | Event data. |
Overrides
InitializeDropDownContainer()
Called to initialize contents of the drop-down container for the first time.
Declaration
protected override void InitializeDropDownContainer()
Overrides
OnBeginEdit()
Used to change the behavior of the OnBeginEdit event
Declaration
protected override void OnBeginEdit()
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 | Represents the row value |
System.Int32 | colIndex | Represents the column value |
System.Int32 | button | Used to get the value of button |
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 | The System.Windows.Forms.MouseEventArgsthat contains event data. |
Overrides
OnDeactivating()
Used to change the behavior of the OnDeactivating event.
Declaration
protected override bool OnDeactivating()
Returns
Type |
---|
System.Boolean |
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
OnEndEdit()
Used to change the behavior of the OnEndEdit event
Declaration
protected override void OnEndEdit()
Overrides
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
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. |
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 | Event data. |
PanelKeyDown(Object, KeyEventArgs)
Event handler for the KeyDown event of the GridRichTextEntryPanel.
Declaration
protected virtual void PanelKeyDown(object sender, KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The source of the event. |
System.Windows.Forms.KeyEventArgs | e | A KeyEventArgs that contains the 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 | Event data. |