Class GridCellRendererBase
This is a base class for the renderer part of a cell type.
Inheritance
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public class GridCellRendererBase : NonFinalizeDisposable, IQueryFocusInside, IGridDropDownCell, IPopupParent, IPopupItem, IDisposable
Remarks
A renderer is created for each GridCellModelBase and GridControlBase. There can be several renderers associated with one GridCellModelBase if several views display the same GridModel.
You typically access cell renderers through the CellRenderers property of the GridControlBase class.
Constructors
GridCellRendererBase(GridControlBase, GridCellModelBase)
Initializes a new instance of the GridCellRendererBase class for the given GridControlBase and GridCellModelBase
Declaration
public GridCellRendererBase(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
AlwaysRaiseCellClick
Gets or sets a value indicating whether a CellClick event should always be raised. If this property is false, it depends on Clickable if CellClick is raised.
Declaration
public bool AlwaysRaiseCellClick { get; set; }
Property Value
Type |
---|
System.Boolean |
ClickOverImage
Gets or sets a value indicating whether the mouse was over an image (see ImageIndex) in static cell when the mouse was released.
Declaration
protected bool ClickOverImage { get; set; }
Property Value
Type |
---|
System.Boolean |
ColIndex
Gets or sets the column id of the current cell.
Declaration
public int ColIndex { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
This value is only valid if GridControlBase::Init has been called and intrinsic state is initialized; if the control is currently not used as current cell, the value is undetermined.
Control
Gets a reference to the associated control. If no control is associated with the cell type, NULL will be returned.
Declaration
public Control Control { get; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.Control | Reference to the associated control. Can be NULL. |
ControlText
Gets or sets the active text that is displayed for the current cell, e.g. TextBox.Text.
Declaration
public virtual string ControlText { get; set; }
Property Value
Type |
---|
System.String |
ControlValue
Gets or sets the cell value for the current cell.
Declaration
public virtual object ControlValue { get; set; }
Property Value
Type |
---|
System.Object |
CurrentCell
Gets a reference to GridCurrentCell implementation of the GridControlBase this cell renderer is associated with.
Declaration
public GridCurrentCell CurrentCell { get; }
Property Value
Type |
---|
GridCurrentCell |
CurrentStyle
Gets the current view style for the current cell.
Declaration
public GridStyleInfo CurrentStyle { get; }
Property Value
Type |
---|
GridStyleInfo |
DropDownButton
Gets or sets the drop-down button.
Declaration
public GridCellButton DropDownButton { get; set; }
Property Value
Type |
---|
GridCellButton |
DropDownContainer
Gets the container where you can insert child controls to be displayed as drop-down part for your cell.
Declaration
public IGridDropDownContainer DropDownContainer { get; }
Property Value
Type |
---|
IGridDropDownContainer |
DropDownImp
Gets or sets a helper object for drop-down cell functionality.
Declaration
public IGridDropDownCellImp DropDownImp { get; set; }
Property Value
Type |
---|
IGridDropDownCellImp |
DropDownPart
Gets or sets the IGridDropDownCellImp that provides drop-down logic for this renderer.
Declaration
public IGridDropDownCellImp DropDownPart { get; set; }
Property Value
Type |
---|
IGridDropDownCellImp |
ForceRefreshOnActivateCell
Gets or sets a value indicating whether your control needs to be refreshed when it becomes the current cell in the grid.
Declaration
public bool ForceRefreshOnActivateCell { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
If you set this attribute to be true, some grid internal optimizations with outlining the current cell are turned off. These optimizations assume that the style of a cell does not change when it has become the current cell. If your control's appearance depends on whether it is a current cell or not, you should set this attribute True ( default is False). For example, if you have a password control which should be drawn with plain text only when it is the current cell, you may set the ForceRefreshOnActivateCell attribute of the specific control to be true.
Grid
Gets a reference to the parent grid.
Declaration
public GridControlBase Grid { get; }
Property Value
Type |
---|
GridControlBase |
HasControlText
Gets a value indicating whether ControlText for the current cell has been set.
Declaration
public bool HasControlText { get; }
Property Value
Type |
---|
System.Boolean |
HasControlValue
Gets a value indicating whether the cell value for the current cell has been changed.
Declaration
public bool HasControlValue { get; }
Property Value
Type |
---|
System.Boolean |
HasFocusControl
Gets a value indicating whether the cell renderer has the focus (is in-place edit mode).
Declaration
public bool HasFocusControl { get; }
Property Value
Type |
---|
System.Boolean |
InBeginEdit
Gets a value indicating whether OnBeginEdit() was called.
Declaration
public bool InBeginEdit { get; }
Property Value
Type |
---|
System.Boolean |
InInitialize
Gets a value indicating whether is in initialize method. True while in initialize method.
Declaration
protected bool InInitialize { get; }
Property Value
Type |
---|
System.Boolean |
Initalized
Gets a value indicating whether this cell type serves as current cell or if the current cell is at the specified row and column id.
Declaration
public bool Initalized { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True if control is used as current cell; False if control is not current cell. |
InSetControlText
Gets a value indicating whether ControlText setter was called. True when ControlText setter was called.
Declaration
public bool InSetControlText { get; }
Property Value
Type |
---|
System.Boolean |
InSetControlValue
Gets a value indicating whether the ControlValue setter was called. True if ControlValue setter was called.
Declaration
public bool InSetControlValue { get; }
Property Value
Type |
---|
System.Boolean |
InSetSetControlValue
Gets a value indicating whether SetControlValue(Object, Boolean) method was called. True when SetControlValue(Object, Boolean) method was called.
Declaration
public bool InSetSetControlValue { get; }
Property Value
Type |
---|
System.Boolean |
IsDisposed
Gets a value indicating whether object has been disposed.
Declaration
public bool IsDisposed { get; }
Property Value
Type |
---|
System.Boolean |
IsDisposing
Gets a value indicating whether object is executing Dispose() method call. Returns true if object is executing Dispose() method call.
Declaration
public bool IsDisposing { get; }
Property Value
Type |
---|
System.Boolean |
IsDroppedDown
Gets a value indicating whether the current cell is in a dropped-down state.
Declaration
protected virtual bool IsDroppedDown { get; }
Property Value
Type |
---|
System.Boolean |
IsEditing
Gets a value indicating whether BeginEdit has been called.
Declaration
protected bool IsEditing { get; }
Property Value
Type |
---|
System.Boolean |
Model
Gets or sets a reference to the GridCellModelBase that this cell renderer is associated with.
Declaration
public GridCellModelBase Model { get; set; }
Property Value
Type |
---|
GridCellModelBase |
MouseDownPoint
Gets or sets the cached mouse position of the last MouseDown event.
Declaration
protected Point MouseDownPoint { get; set; }
Property Value
Type |
---|
System.Drawing.Point |
MouseDownTick
Gets or sets the cached Environment.TickCount of the last MouseDown event.
Declaration
protected int MouseDownTick { get; set; }
Property Value
Type |
---|
System.Int32 |
RowIndex
Gets or sets the row id of the current cell.
Declaration
public int RowIndex { get; set; }
Property Value
Type |
---|
System.Int32 |
Remarks
This value is only valid if GridControlBase::Init has been called and an intrinsic state is initialized; if the control is currently not used as current cell, the value is undetermined.
ScaleFactor
Gets the scale factor based on current DPI.
Declaration
protected float ScaleFactor { get; }
Property Value
Type |
---|
System.Single |
StyleInfo
Gets a reference to the style object associated with the current cell.
Declaration
public GridStyleInfo StyleInfo { get; }
Property Value
Type |
---|
GridStyleInfo |
SupportsEditing
Gets or sets a value indicating whether the cell renderer supports being switched into edit mode. Default is true, only for GridStaticCellRenderer and GridHeaderCellRenderer it is false.
Declaration
public bool SupportsEditing { get; set; }
Property Value
Type |
---|
System.Boolean |
SupportsFocusControl
Gets or sets a value indicating whether the cell renderer supports in-place editing with focus
Declaration
public bool SupportsFocusControl { get; set; }
Property Value
Type |
---|
System.Boolean |
Methods
AddButton(GridCellButton)
Adds a GridCellButton to the cell renderers list of cell buttons.
Declaration
protected void AddButton(GridCellButton button)
Parameters
Type | Name | Description |
---|---|---|
GridCellButton | button | The GridCellButton to add. |
CanCopy()
Determines whether current cell can be copied to clipboard.
Declaration
public virtual bool CanCopy()
Returns
Type | Description |
---|---|
System.Boolean | True if copy is supported; otherwise False. |
CanCut()
Determines whether current cell can be cut to clipboard.
Declaration
public virtual bool CanCut()
Returns
Type | Description |
---|---|
System.Boolean | True if cut is supported; otherwise False. |
CanPaste()
Determines whether current cell can be pasted from clipboard.
Declaration
public virtual bool CanPaste()
Returns
Type | Description |
---|---|
System.Boolean | True if paste is supported; otherwise False. |
ChildClosing(IPopupChild, PopupCloseType)
Will be called to indicate that the popup child was closed in the specified mode.
Declaration
public virtual void ChildClosing(IPopupChild childUI, PopupCloseType popupCloseType)
Parameters
Type | Name | Description |
---|---|---|
IPopupChild | childUI | The child that was closed. |
PopupCloseType | popupCloseType | A PopupCloseType value. |
ControlDoubleClick(Object, EventArgs)
Handles the DoubleClick event of the embedded control and raises the CurrentCellControlDoubleClick event.
Declaration
protected virtual void ControlDoubleClick(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The source of the event. |
System.EventArgs | e | Event data. |
ControlGotFocus(Object, EventArgs)
Handles the GotFocus event of the embedded control and raises the CurrentCellControlGotFocus event.
Declaration
protected virtual void ControlGotFocus(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The source of the event. |
System.EventArgs | e | An System.EventArgs that contains event data. |
ControlLostFocus(Object, EventArgs)
Handles the LostFocus event of the embedded control and raises the CurrentCellControlLostFocus event.
Declaration
protected virtual void ControlLostFocus(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The source of the event. |
System.EventArgs | e | An System.EventArgs that contains event data. |
ControlMouseDown(Object, MouseEventArgs)
Handles the Control.MouseDown event of the attached cell control.
Declaration
protected void ControlMouseDown(object sender, MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | Source of the event. |
System.Windows.Forms.MouseEventArgs | e | The MouseEventArgs with mouse position relative to top-left corner of cell. |
Copy()
Called when user initiates a clipboard copy and the grid has a current cell but no range is selected.
Declaration
public virtual bool Copy()
Returns
Type | Description |
---|---|
System.Boolean | True if successful; False if failed. |
Remarks
Copy() performs the following tasks:
a) Copy selected text as formatted in the cell.
b) Only if cell is inactive copy the GridStyleInfo info for the cell.
CreateDropDownContainer()
Creates a GridDropDownContainer and associates it with the cell's parent grid.
Declaration
protected virtual IGridDropDownContainer CreateDropDownContainer()
Returns
Type | Description |
---|---|
IGridDropDownContainer | The container where you can insert child controls to be displayed as drop-down part for your cell. |
Cut()
Called when user initiates a clipboard cut and the grid has a current cell but no range is selected.
Declaration
public virtual bool Cut()
Returns
Type | Description |
---|---|
System.Boolean | True if successful; False if failed. |
Dispose()
Releases the all resources used by the component.
Declaration
public void Dispose()
Dispose(Boolean)
Unwire any events subscribed from GridControlBase and releases cell buttons.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Overrides
Remarks
See the documentation for the System.ComponentModel.Component class and its Dispose member.
Draw(Graphics, Rectangle, Int32, Int32, GridStyleInfo)
Draw the contents of the specified cell.
Declaration
public virtual void Draw(Graphics g, Rectangle cellRectangle, int rowIndex, int colIndex, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | Points to the device context. |
System.Drawing.Rectangle | cellRectangle | Specifies the cell rectangle. |
System.Int32 | rowIndex | Specifies the row id. |
System.Int32 | colIndex | Specifies the column id. |
GridStyleInfo | style | A reference to the style of the cell. |
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.
Please note that you should first call DrawBackground to draw the background and borders as specified in the style object.
The base-class version of this method first calls PerformLayout and then the cell renderers OnDraw method. After the inner cell has been drawn, it will draw each cell button for the cell.
note
Overriding this method is normally not necessary. In most cases, it is sufficient to override the OnDraw method.
DrawBackground(Graphics, Rectangle, GridStyleInfo, Boolean)
Checks if the background for a cell needs drawing and optionally calls OnDrawCellBackground(GridDrawCellBackgroundEventArgs) and also draws the frame for the cell as specified in the style object.
Declaration
protected virtual void DrawBackground(Graphics g, Rectangle rect, GridStyleInfo style, bool fillBackground)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The System.Drawing.Graphics context of the canvas. |
System.Drawing.Rectangle | rect | The Rectangle |
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
System.Boolean | fillBackground | True if background needs to be redrawn. |
Remarks
The method will call OnDrawCellBackground(GridDrawCellBackgroundEventArgs) for covered cells and bannered cells. For regular cells, you can force OnDrawCellBackground(GridDrawCellBackgroundEventArgs) to be called by assigning BrushInfo.Empty to the Interior property of a GridStyleInfo. You can do this in OnPrepareViewStyleInfo(GridPrepareViewStyleInfoEventArgs), for example.
Otherwise OnDrawCellBackground(GridDrawCellBackgroundEventArgs) will not be called for regular cells because of internal drawing optimizations within the grid. By default the grid optimizes drawing such that the background of neighboring cells with the same color is drawn in one operation.
After the background of a cell has been drawn (either by a call to OnDrawCellBackground(GridDrawCellBackgroundEventArgs) or because of earlier drawing inside the grid) the cells frame is drawn as specified with CellAppearance by calling DrawCellAppearance(Graphics, Rectangle, GridStyleInfo).
DrawCellAppearance(Graphics, Rectangle, GridStyleInfo)
Draws the frame for the cells appearance (sunken or raised).
Declaration
protected virtual void DrawCellAppearance(Graphics g, Rectangle rect, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The System.Drawing.Graphics context of the canvas. |
System.Drawing.Rectangle | rect | The System.Drawing.Rectangle with the bounds. |
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
Remarks
If you want to draw custom borders around a cell, be sure to reserve space for the extra area occupied by your borders. See BorderMargins.
DrawSingleCell(Graphics, Rectangle, Int32, Int32, GridStyleInfo, Boolean)
Draw the contents of the specified cell including cell background and optionally also the borders. Call this method if you want to draw a stand-alone cell and you want to ensure that also the background of the cell and also the borders are painted.
Declaration
public void DrawSingleCell(Graphics g, Rectangle cellRectangle, int rowIndex, int colIndex, GridStyleInfo style, bool includeBorders)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | Points to the device context. |
System.Drawing.Rectangle | cellRectangle | Specifies the cell rectangle. |
System.Int32 | rowIndex | Specifies the row id. |
System.Int32 | colIndex | Specifies the column id. |
GridStyleInfo | style | A reference to the style of the cell. |
System.Boolean | includeBorders | Specifies whether borders should also be drawn or excluded. |
Remarks
The method calls DrawBackground to draw the background as specified in the style object.
If includeBorders is false the area covered by borders is excluded when the rectangle is passed to the DrawBackground method.
DropDownContainerCloseDropDown(Object, PopupClosedEventArgs)
Will be called to indicate that the popup child was closed.
Declaration
public virtual 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. |
DropDownContainerShowedDropDown(Object, EventArgs)
Occurs after the popup has been dropped-down and made visible.
Declaration
public virtual void DropDownContainerShowedDropDown(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The source of the event. |
System.EventArgs | e | Event data. |
DropDownContainerShowingDropDown(Object, CancelEventArgs)
Occurs when the drop-down container is about to be shown.
Declaration
public virtual void DropDownContainerShowingDropDown(object sender, CancelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The source of the event. |
System.ComponentModel.CancelEventArgs | e | Event data. |
EnsureDropDownContainer()
Ensures the container is valid and initialized.
Declaration
public void EnsureDropDownContainer()
FindText(String, Int32, Int32, GridFindTextOptions, Boolean)
Searches the specified text and optionally moves the current cell to the cell if the text was found.
Declaration
public virtual bool FindText(string find, int rowIndex, int colIndex, GridFindTextOptions options, bool bSetCell)
Parameters
Type | Name | Description |
---|---|---|
System.String | find | The text to be searched. |
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
GridFindTextOptions | options | Search criteria. |
System.Boolean | bSetCell | True if current cell should be moved after text was found. |
Returns
Type | Description |
---|---|
System.Boolean | True if text was found; False otherwise. |
GetButton(Int32)
Returns a reference to the GridCellButton at the specified index.
Declaration
protected GridCellButton GetButton(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index of the GridCellButton. |
Returns
Type | Description |
---|---|
GridCellButton | The GridCellButton at the index. |
GetCellBoundsCore(Int32, Int32)
Returns a rectangle with cell bounds for the specified cell. For covered cell, the total of all covered cells will be returned.
Declaration
public Rectangle GetCellBoundsCore(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | The System.Drawing.Rectangle with the bounds. |
GetCellBoundsCore(Int32, Int32, Boolean)
Returns a rectangle with cell bounds for the specified cell. For covered cell, the total of all covered cells will be returned.
Declaration
public Rectangle GetCellBoundsCore(int rowIndex, int colIndex, bool includeFloated)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
System.Boolean | includeFloated | Specifies if the range covered by a floating cell should be returned |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | The System.Drawing.Rectangle with the bounds. |
GetCellBoundsCoreInt(Int32, Int32, Boolean)
For internal use.
Declaration
public Rectangle GetCellBoundsCoreInt(int rowIndex, int colIndex, bool nonClientIfVisible)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | Index of the row. |
System.Int32 | colIndex | Index of the col. |
System.Boolean | nonClientIfVisible | if set to |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | returns Rectangle |
GetCellClientRectangle(Int32, Int32, GridStyleInfo, Boolean)
Declaration
public Rectangle GetCellClientRectangle(int rowIndex, int colIndex, GridStyleInfo style, bool floatedCells)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | |
System.Int32 | colIndex | |
GridStyleInfo | style | |
System.Boolean | floatedCells |
Returns
Type |
---|
System.Drawing.Rectangle |
GetCellLayout(Int32, Int32, GridStyleInfo)
Declaration
public GridCellLayout GetCellLayout(int rowIndex, int colIndex, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | |
System.Int32 | colIndex | |
GridStyleInfo | style |
Returns
Type |
---|
GridCellLayout |
GetCellText(GridStyleInfo, GridFindTextOptions)
Get the text of particular cell
Declaration
protected virtual string GetCellText(GridStyleInfo style, GridFindTextOptions options)
Parameters
Type | Name | Description |
---|---|---|
GridStyleInfo | style | style of the cell |
GridFindTextOptions | options | GridFindTextOptions |
Returns
Type | Description |
---|---|
System.String | Text |
GetCellValue()
Returns ControlValue.
Declaration
public virtual object GetCellValue()
Returns
Type | Description |
---|---|
System.Object | Cell value. |
GetDisplayText()
Returns ControlText.
Declaration
public virtual string GetDisplayText()
Returns
Type | Description |
---|---|
System.String | Display text. |
GetEditState()
Returns state information that lets you restore the current editing state (e.g. caret position or other cell-type specific information) at a later point with SetEditState(Object).
Declaration
public virtual object GetEditState()
Returns
Type | Description |
---|---|
System.Object | A cell-type specific object with editing state information. |
Remarks
You need to override this method in a derived cell-type class. Otherwise calling this method will have no effect.
Examples
This example shows how to get the edit state of the cell.
//Scroll position based on the column index.
public override object GetEditState()
{
if (this.gridControl1.CurrentCell.IsEditing)
{
return new int[] { 0, this.gridControl1[this.gridControl1.CurrentCell.RowIndex,this.gridControl1.CurrentCell.ColIndex].Text.Length };
}
return null;
}
Public Overrides Function GetEditState() As Object
If Me.gridControl1.CurrentCell.IsEditing Then
Return New Integer(){ 0, Me.gridControl1(Me.gridControl1.CurrentCell.RowIndex, Me.gridControl1.CurrentCell.ColIndex).Text.Length }
End If
Return Nothing
End Function
GetMarkHeaderState(Int32, Int32, GridStyleInfo)
Checks if this is a header cell that should indicate current cell position.
Declaration
protected virtual bool GetMarkHeaderState(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 | True if header shall be outlined; False otherwise. |
GetNestedCurrentCell()
Returns a nested current cell if this cell type hosts a GridControl by itself (for example GridNestedTableControlCellRenderer with a GridGroupingControl overrides this method).
Declaration
public virtual GridCurrentCell GetNestedCurrentCell()
Returns
Type | Description |
---|---|
GridCurrentCell | A nested current cell object. |
GetSelectedText(out String)
Return the selected text in the current cell.
Declaration
public virtual bool GetSelectedText(out string strResult)
Parameters
Type | Name | Description |
---|---|---|
System.String | strResult | The resulting string with the selected text |
Returns
Type | Description |
---|---|
System.Boolean | True if successful; False if failed. |
Hide()
If there is a control associated with the cell type (for in-place editing), override this method to hide the control.
Declaration
public virtual void Hide()
InitalizedAt(Int32, Int32)
Determines whether this cell type serves as current cell or if the current cell is at the specified row and column id.
Declaration
[Obsolete("Use InitializedAt method instead")]
public bool InitalizedAt(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 if control is used as current cell; False if control is not current cell. |
Initialize(Int32, Int32)
Initializes the intrinsic state of the control for the current cell.
Declaration
public void Initialize(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | Specifies the row id. |
System.Int32 | colIndex | Specifies the column id. |
Remarks
Initializes the intrinsic state (e.g., row, column, style) of the control for the current cell. This method is called when the current cell has moved. The operations that follow all depend on the intrinsic state of the control.
Initialize calculates the cell layout (inner, client rectangle bounds) and then calls OnInitialize.
InitializeControlText(Object)
Initializes ControlText based on the specified cell value.
Declaration
protected virtual void InitializeControlText(object controlValue)
Parameters
Type | Name | Description |
---|---|---|
System.Object | controlValue | The cell value. See the CellValue of the GridStyleInfo class. |
Remarks
The default behavior of this method is to call GetFormattedText(Object) of the StyleInfo object and then raise a CurrentCellInitializeControlText event.
The user can catch the event and change the ControlText property of the GridCurrentCellInitializeControlTextEventArgs object.
InitializedAt(Int32, Int32)
Determines whether this cell type serves as current cell or if the current cell is at the specified row and column id.
Declaration
public bool InitializedAt(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 if control is used as current cell; False if control is not current cell. |
InitializeDropDownContainer()
Called to initialize contents of the drop-down container for the first time.
Declaration
protected virtual void InitializeDropDownContainer()
IsControlVisible()
Determines if there is a control associated with the cell type (for in-place editing) and if it is visible.
Declaration
public virtual bool IsControlVisible()
Returns
Type | Description |
---|---|
System.Boolean | True if it is visible; False otherwise. |
IsPointOverImage(Int32, Int32, Point)
Checks if the specified point is over an image (see ImageIndex) .
Declaration
protected virtual bool IsPointOverImage(int rowIndex, int colIndex, Point pt)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
System.Drawing.Point | pt | The point to be tested. |
Returns
Type | Description |
---|---|
System.Boolean | True if inside image; False otherwise. |
IsReadOnly()
Returns whether the current cell is Read-only.
Declaration
public virtual bool IsReadOnly()
Returns
Type | Description |
---|---|
System.Boolean | True if Read-only; False otherwise. |
IsRelatedControl(Control, Boolean)
Called to find out whether a specified control is part of the popup hierarchy.
Declaration
public virtual bool IsRelatedControl(Control control, bool askPopupParent)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control | A control instance. |
System.Boolean | askPopupParent | True indicates this query should be passed to the IPopupParent, if any; False indicates you should not query the popup parent. |
Returns
Type | Description |
---|---|
System.Boolean | True if the control is part of the popup hierarchy; False if not. |
See Also
NotifyCurrentCellChanged()
Raises the GridCurrentCell.CellChanged event indicating the contents of the current cell have been changed (e.g. in response to a TextBox.Changed event).
Declaration
protected virtual void NotifyCurrentCellChanged()
Remarks
If you have implemented a custom cell type you should call this method from your derived renderer if you support modifying the cell contents.
NotifyCurrentCellChanging()
Raises the GridCurrentCell.CellChanging event indicating the contents of the current cell are about to be changed by the user.
Declaration
protected virtual bool NotifyCurrentCellChanging()
Returns
Type | Description |
---|---|
System.Boolean | True if cell contents can be modified; False if cell contents should not be changed. |
Remarks
Call this method from your derived renderer if you support modifying the cell contents the first time before the user edits the cell.
NotifyCurrentCellControlDoubleClick(Control)
Raises the GridCurrentCell.ControlDoubleClick event indicating the cell has in-place editing mode and the user double-clicked inside the control associated with the current cell.
Declaration
protected void NotifyCurrentCellControlDoubleClick(Control control)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control | A reference to the control associated with the current cell. |
Remarks
GridCurrentCell.ControlDoubleClick lets you detect a double click inside a cell for any CurrentCellActivateBehavior. If for example the focus is set to the renderers control after the first click, the grid will listen for a MouseDown on the newly focused control and raise this event on a second click.
NotifyCurrentCellControlGotFocus(Control)
Raises the GridCurrentCell.ControlGotFocus event indicating the cell has switched to in-place editing and the control associated with the current cell has received the focus.
Declaration
protected void NotifyCurrentCellControlGotFocus(Control control)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control | A reference to the control associated with the current cell. |
Remarks
No derived renderer currently calls this method.
NotifyCurrentCellControlLostFocus(Control)
Raises the GridCurrentCell.ControlLostFocus event indicating the cell has switched to in-place editing and the control associated with the current cell has lost the focus.
Declaration
protected void NotifyCurrentCellControlLostFocus(Control control)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control | Control associated with the current cell. |
Remarks
No derived renderer currently calls this method.
NotifyShowedDropDown()
Raises the OnCurrentCellShowedDropDown(EventArgs) for the parent grid.
Declaration
protected void NotifyShowedDropDown()
NotifyShowingDropDown(ref Size)
Raises the OnCurrentCellShowingDropDown(GridCurrentCellShowingDropDownEventArgs) for the parent grid.
Declaration
protected bool NotifyShowingDropDown(ref Size size)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Size | size | The suggested size of the drop-down. |
Returns
Type | Description |
---|---|
System.Boolean | True if drop-down should be shown; False if operation should be canceled. |
OnActivated()
This is called after the activating event and notifies that at this time the current cell has now become the active current cell.
Declaration
protected virtual void OnActivated()
OnActivating(Int32, Int32)
This is called from GridCurrentCell.Activate after the activating event has been raised and allows interception of cell activation.
Declaration
protected virtual 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. |
Remarks
When the current cell is moved from one position to another, Essential Grid will first deactivate the current cell and afterwards activate the current cell at the new position. At the time activate is called, the old current cell is deactivated and Essential Grid has no active current cell.
OnBeginEdit()
Called from GridCurrentCell.BeginEdit. Checks if cell renderer support in place editing. If in-place editing is supported, Syncfusion.Windows.Forms.Grid.GridCellRendererBase.SetHasFocusControl(System.Boolean) is called which triggers OnHasFocusControlChanged() and initiates repainting the cell. In your overridden OnDraw(Graphics, Rectangle, Int32, Int32, GridStyleInfo) method, you should then check ShouldDrawFocused(Int32, Int32).
Declaration
protected virtual void OnBeginEdit()
OnButtonClicked(Int32, Int32, Int32)
This method is called when the user clicks a cell button inside cell.
Declaration
protected virtual void OnButtonClicked(int rowIndex, int colIndex, int button)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
System.Int32 | button | The button |
Remarks
In your overridden version of this method, you can activate the current cell for the given row and column index and then drop-down a list.
OnCancelMode(Int32, Int32)
This is called from GridClickCellsMouseController or GridSelectCellsMouseController when your cell renderer has indicated in its OnHitTest override that it wants to receive mouse events and the mouse operation is canceled.
Declaration
protected virtual void OnCancelMode(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
OnCellLayoutChanged()
Called when the ViewLayout of the parent grid is changed, for example if grid is scrolled or row height is changed.
Declaration
protected virtual void OnCellLayoutChanged()
OnClick(Int32, Int32, MouseEventArgs)
This is called from GridSelectCellsMouseController when the user clicked inside a cell.
Declaration
protected virtual 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. |
OnCloseDropDown(PopupCloseType)
This is called from GridCurrentCell.CloseDropDown.
Declaration
protected virtual void OnCloseDropDown(PopupCloseType reason)
Parameters
Type | Name | Description |
---|---|---|
PopupCloseType | reason |
Remarks
If your renderer supports dropped-down state, the drop-down window should be made closed at this time.
OnControlDoubleClick(Control)
Occurs when the current cell has in-place editing mode and the user double-clicked inside the control associated with the current cell.
Declaration
protected virtual void OnControlDoubleClick(Control control)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control |
Remarks
GridCurrentCell.ControlDoubleClick lets you detect a double click inside a cell for any CurrentCellActivateBehavior. If for example the focus is set to the renderers control after the first click, the grid will listen for a MouseDown on the newly focused control and raise this event on a second click.
Raising this event is only optional for the cell renderer that manages the active cell.
A text box will usually send this event when the associated System.Windows.Forms.TextBox control has received the focus after the cell was switched into edit mode and the user double-clicked. Other cell renderers may or may not send this event.
OnDeactivating()
Called from GridCurrentCell.Deactivate after GridCurrentCell.Deactivating event and before the current cell is deactivated.
Declaration
protected virtual bool OnDeactivating()
Returns
Type | Description |
---|---|
System.Boolean | True if renderer can be deactivated; False if deactivation should be aborted. |
OnDeactived(Int32, Int32)
Called from GridCurrentCell.Deactivated after the current cell is deactivated and before the GridCurrentCell.Deactivated event.
Declaration
protected virtual void OnDeactived(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | |
System.Int32 | colIndex |
OnDeleting()
Occurs before the text box contents are deleted when user presses
Declaration
protected virtual bool OnDeleting()
Returns
Type | Description |
---|---|
System.Boolean | True if cell contents can be cleared. |
OnDoubleClick(Int32, Int32, MouseEventArgs)
This is called from GridSelectCellsMouseController when the user double-clicks inside a cell.
Declaration
protected virtual void OnDoubleClick(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. |
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 virtual 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. |
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.
OnDrawCellBackground(GridDrawCellBackgroundEventArgs)
Called to draw / erase the background for a cell.
Declaration
protected virtual void OnDrawCellBackground(GridDrawCellBackgroundEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridDrawCellBackgroundEventArgs | e | A GridDrawCellBackgroundEventArgs that contains the event data. |
Remarks
This method is called for covered cells and bannered cells. For regular cells, you can force OnDrawCellBackground(GridDrawCellBackgroundEventArgs) to be called by assigning BrushInfo.Empty to the Interior property of a GridStyleInfo. You can do this for example in OnPrepareViewStyleInfo(GridPrepareViewStyleInfoEventArgs).
Otherwise OnDrawCellBackground(GridDrawCellBackgroundEventArgs) will not be called for regular cells because of internal drawing optimizations within the grid. By default the grid optimizes drawing such that the background of neighboring cells with the same color is drawn in one operation.
The method will also not be called if you handle the DrawCellBackground event of GridControlBase and set e.Cancel = true.
The default version of this method fills the entire background as specified with Interior and also draws the image specified with BackgroundImage.
OnDrawCellButton(GridCellButton, Graphics, Int32, Int32, Boolean, GridStyleInfo)
Draws the cell button element at the specified row and column index.
Declaration
protected virtual void OnDrawCellButton(GridCellButton button, Graphics g, int rowIndex, int colIndex, bool bActive, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
GridCellButton | button | The GridCellButton to be drawn. |
System.Drawing.Graphics | g | The System.Drawing.Graphics context of the canvas. |
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
System.Boolean | bActive | True if this is the active current cell; False otherwise. |
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
OnDrawCellButtonBackground(GridCellButton, Graphics, Rectangle, ButtonState, GridStyleInfo)
Draws a button using System.Windows.Forms.ControlPaint.DrawButton(System.Drawing.Graphics,System.Drawing.Rectangle,System.Windows.Forms.ButtonState); if XP Themes are enabled, button will be drawn themed.
Declaration
protected virtual void OnDrawCellButtonBackground(GridCellButton button, Graphics g, Rectangle rect, ButtonState buttonState, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
GridCellButton | button | The GridCellButton to be drawn. |
System.Drawing.Graphics | g | The System.Drawing.Graphics context of the canvas. |
System.Drawing.Rectangle | rect | The System.Drawing.Rectangle with the bounds. |
System.Windows.Forms.ButtonState | buttonState | A System.Windows.Forms.ButtonState that specifies the current state. |
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
Remarks
Override this method if you want to have buttons with a customized color, e.g. a push button drawn with the back color as specified with the interior property.
Examples
This example draws a custom button element background.
public static void Draw3dFrame(Graphics g, int x0, int y0, int x1, int y1, int w, Color rgbTopLeft, Color rgbBottomRight)
{
Rectangle rc;
for (int i = 0; i != w; i++)
{
// Top
Brush brTL = new SolidBrush(rgbTopLeft);
rc = Rectangle.FromLTRB(x0, y0, x1, y0+1);
g.FillRectangle(brTL, rc);
// Left
rc = Rectangle.FromLTRB(x0, y0, x0+1, y1);
g.FillRectangle(brTL, rc);
brTL.Dispose();
Brush brBR = new SolidBrush(rgbBottomRight);
// Bottom
rc = Rectangle.FromLTRB(x0, y1, x1+1, y1+1);
g.FillRectangle(brBR, rc);
// Right
rc = Rectangle.FromLTRB(x1, y0, x1+1, y1);
g.FillRectangle(brBR, rc);
brBR.Dispose();
if (i != w-1)
{
x0++;
y0++;
x1--;
y1--;
}
}
}
protected override void OnDrawCellButtonBackground(GridCellButton button, Graphics g, Rectangle rect, ButtonState buttonState, GridStyleInfo style)
{
bool drawPressed = (buttonState & ButtonState.Pushed) != 0;
Color hilight = SystemColors.ControlLightLight;
Color shadow = SystemColors.ControlDarkDark;
if (!drawPressed)
{
GridPaint.Draw3dFrame(g, rect.Left, rect.Top, rect.Right-1, rect.Bottom-1, 1,
hilight, shadow);
}
else
{
Brush br = new SolidBrush(shadow);
g.FillRectangle(br, Rectangle.FromLTRB(rect.Left, rect.Bottom-1, rect.Right-1, rect.Bottom));
g.FillRectangle(br, Rectangle.FromLTRB(rect.Right-1, rect.Top, rect.Right, rect.Bottom));
br.Dispose();
}
}
Public Shared Sub Draw3dFrame(g As Graphics, x0 As Integer, y0 As Integer, x1 As Integer, y1 As Integer, w As Integer, rgbTopLeft As Color, rgbBottomRight As Color)
Dim rc As Rectangle
Dim i As Integer
While i <> w
' Top
Dim brTL = New SolidBrush(rgbTopLeft)
rc = Rectangle.FromLTRB(x0, y0, x1, y0 + 1)
g.FillRectangle(brTL, rc)
' Left
rc = Rectangle.FromLTRB(x0, y0, x0 + 1, y1)
g.FillRectangle(brTL, rc)
brTL.Dispose()
Dim brBR = New SolidBrush(rgbBottomRight)
' Bottom
rc = Rectangle.FromLTRB(x0, y1, x1 + 1, y1 + 1)
g.FillRectangle(brBR, rc)
' Right
rc = Rectangle.FromLTRB(x1, y0, x1 + 1, y1)
g.FillRectangle(brBR, rc)
brBR.Dispose()
If i <> w - 1 Then
x0 += 1
y0 += 1
x1 -= 1
y1 -= 1
End If
i += 1
End While
End Sub 'Draw3dFrame
Protected Overrides Sub OnDrawCellButtonBackground(button As GridCellButton, g As Graphics, rect As Rectangle, buttonState As ButtonState, style As GridStyleInfo)
Dim drawPressed As Boolean = (buttonState And ButtonState.Pushed) <> 0
Dim hilight As Color = SystemColors.ControlLightLight
Dim shadow As Color = SystemColors.ControlDarkDark
If Not drawPressed Then
GridPaint.Draw3dFrame(g, rect.Left, rect.Top, rect.Right - 1, rect.Bottom - 1, 1, hilight, shadow)
Else
Dim br = New SolidBrush(shadow)
g.FillRectangle(br, Rectangle.FromLTRB(rect.Left, rect.Bottom - 1, rect.Right - 1, rect.Bottom))
g.FillRectangle(br, Rectangle.FromLTRB(rect.Right - 1, rect.Top, rect.Right, rect.Bottom))
br.Dispose()
End If
End Sub 'OnDrawCellButtonBackground
OnEditingComplete()
Occurs when the grid completes editing mode for the active current cell.
Declaration
protected virtual void OnEditingComplete()
Remarks
The grid raises this event when the CurrentCell objects EndEdit() or CancelEdit() method is called. The event occurs after CurrentCellRejectedChanges or CurrentCellAcceptedChanges is raised.
You can determine if Deactivate(Boolean) was called stand-alone or as result of a MoveTo(Int32, Int32, GridSetCurrentCellOptions, Boolean) call by checking the IsInMoveTo property.
You can find out about the current cell's position by querying the RowIndex and ColIndex properties of the CurrentCell object in GridControlBase.
See MoveTo(Int32, Int32, GridSetCurrentCellOptions, Boolean) for a discussion about the order of events that you receive when the current cell is moved.
OnEndEdit()
Called from GridCurrentCell.EndEdit. If render had focus, Syncfusion.Windows.Forms.Grid.GridCellRendererBase.SetHasFocusControl(System.Boolean) is called which triggers OnHasFocusControlChanged() and initiates repainting the cell. In your overridden OnDraw(Graphics, Rectangle, Int32, Int32, GridStyleInfo) method, you should then check ShouldDrawFocused(Int32, Int32) which will return False.
Declaration
protected virtual void OnEndEdit()
OnGetCursor(Int32, Int32)
Override this method if you want to change the cursor for this cell.
Declaration
protected virtual Cursor OnGetCursor(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
Returns
Type | Description |
---|---|
System.Windows.Forms.Cursor | The System.Windows.Forms.Cursor to be displayed. |
OnGridGotFocus(EventArgs)
Called when the parent grid of this cell renderer gets the focus.
Declaration
protected virtual void OnGridGotFocus(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | An System.EventArgsthat contains event data. |
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 virtual void OnHasFocusControlChanged()
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.
OnHitTest(Int32, Int32, MouseEventArgs, IMouseController)
This method is called to determine whether the cell renderer wants to receive mouse events for the give cell at the given coordinates.
Declaration
protected virtual int OnHitTest(int rowIndex, int colIndex, MouseEventArgs e, IMouseController controller)
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. |
IMouseController | controller | The current controller requested to handle this mouse event. |
Returns
Type | Description |
---|---|
System.Int32 | Non-zero hit context value if you request to handle the mouse event; zero if you vote not to handle the mouse event. |
Remarks
Override this method and return GridHitTestContext.Cell (or any other non-zero value) to force mouse messages (OnMouseDown, OnMouseHover, OnMouseUp) being called for the cell renderer.
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 virtual void OnInitialize(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
OnKeyDown(KeyEventArgs)
Raises the event when user pressed key down (similar to Control.OnKeyDown).
Declaration
protected virtual void OnKeyDown(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.KeyEventArgs | e | A System.Windows.Forms.KeyEventArgs with data of the keyboard event. |
OnKeyPress(KeyPressEventArgs)
Raises the event when user pressed key (similar to Control.OnKeyPress).
Declaration
protected virtual void OnKeyPress(KeyPressEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.KeyPressEventArgs | e | A System.Windows.Forms.KeyEventArgs with data of the keyboard event. |
OnKeyUp(KeyEventArgs)
Raises the event when user released key (similar to Control.OnKeyUp).
Declaration
protected virtual void OnKeyUp(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.KeyEventArgs | e | A System.Windows.Forms.KeyEventArgs with data of the keyboard event. |
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 virtual 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. |
OnModelChanged(EventArgs)
Override this method if you need to know when reference to cell model is changed. This method is called after the reference to cell model has been changed.
Declaration
protected virtual void OnModelChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Always EventArgs.Empty. |
OnMouseDown(Int32, Int32, MouseEventArgs)
This is called from GridClickCellsMouseController or GridSelectCellsMouseController when your cell renderer has indicated in its OnHitTest override that it wants to receive mouse events and the user has pressed a mouse button.
Declaration
protected virtual void OnMouseDown(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 event data. |
OnMouseHover(Int32, Int32, MouseEventArgs)
This is called from GridClickCellsMouseController or GridSelectCellsMouseController when your cell renderer has indicated in its OnHitTest override that it wants to receive mouse events and the user is moving the mouse over the cell.
Declaration
protected virtual void OnMouseHover(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 event data. |
Remarks
OnMouseHover will only be called after OnMouseHoveEnter. When the user moves the mouse out of the MouseHoverLeave is called.
OnMouseHoverEnter(Int32, Int32)
This is called from GridClickCellsMouseController or GridSelectCellsMouseController when your cell renderer has indicated in its OnHitTest override that it wants to receive mouse events and the user has moved the mouse into the cell.
Declaration
protected virtual void OnMouseHoverEnter(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index of current cell. |
System.Int32 | colIndex | The column index of current cell. |
Remarks
See also OnMouseHoverLeave.
OnMouseHoverLeave(Int32, Int32, EventArgs)
This is called from GridClickCellsMouseController or GridSelectCellsMouseController when your cell renderer has indicated in its OnHitTest override that it wants to receive mouse events and the user is moving the mouse out of the cell.
Declaration
protected virtual void OnMouseHoverLeave(int rowIndex, int colIndex, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
System.EventArgs | e | An System.EventArgs with event data. |
Remarks
Once OnMouseHoveEnter has been called you are guaranteed to receive a OnMouseHoverLeave call either if the user moves the mouse of the cell boundaries or presses a button or if the mouse operation is canceled.
OnMouseMove(Int32, Int32, MouseEventArgs)
This is called from GridClickCellsMouseController or GridSelectCellsMouseController when your cell renderer has indicated in its OnHitTest override that it wants to receive mouse events and the user has pressed a mouse button and is moving the mouse pointer.
Declaration
protected virtual void OnMouseMove(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 event data. |
OnMouseUp(Int32, Int32, MouseEventArgs)
This is called from GridClickCellsMouseController or GridSelectCellsMouseController when your cell renderer has indicated in its OnHitTest override that it wants to receive mouse events and the user has pressed a mouse button and is releasing the button.
Declaration
protected virtual void OnMouseUp(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 event data. |
OnNotifyMsg(ref Message)
Called from OnVScroll, OnHScroll before grid is scrolled.
Declaration
public virtual void OnNotifyMsg(ref Message pMsg)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Message | pMsg | The Message |
Remarks
Will deactivate the current cell when the user scrolls to the right and the current cell is a floating or covered cell which spans the freeze columns / row line.
Also, any dropped-down windows will be closed.
OnOutlineCurrentCell(Graphics, Rectangle)
Highlights the current cell by inverting the cells border or drawing a thick border.
Declaration
protected virtual void OnOutlineCurrentCell(Graphics g, Rectangle r)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | Points to the device context. |
System.Drawing.Rectangle | r | Specifies the cell rectangle. |
Remarks
Override this method if you don't want the default highlighting of your cell.
OnPrepareViewStyleInfo(GridPrepareViewStyleInfoEventArgs)
Allows custom formatting of a cell by changing its style object.
Declaration
public virtual void OnPrepareViewStyleInfo(GridPrepareViewStyleInfoEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridPrepareViewStyleInfoEventArgs | e | Event data |
Remarks
OnPrepareViewStyleInfo(GridPrepareViewStyleInfoEventArgs) is called from PrepareViewStyleInfo in order to allow custom formatting of a cell by changing its style object.
Set the cancel property true if you want to avoid the associated cell renderers object OnPrepareViewStyleInfo(GridPrepareViewStyleInfoEventArgs) method to be called.
Changes made to the style object will not be saved in the grid nor cached. This event is called every time a portion of the grid is repainted and the specified cell belongs to the invalidated region of the window that needs to be redrawn.
Changes to the style object done at this time will also not be reflected when accessing cells though the models indexer. See QueryCellInfo.
note
Do not change base style or cell type at this time.
See Also
OnQueryShowButtons(Int32, Int32, GridStyleInfo)
Determines whether the cell buttons shall be drawn for the specific row and column index.
Declaration
protected virtual 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 to indicate the cell buttons shall be drawn for the specific row and column index. |
OnRejectChanges()
This is called from GridCurrentCell.RejectChanges. Any drop-downs have been closed at this time.
Declaration
protected virtual void OnRejectChanges()
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 virtual bool OnSaveChanges()
Returns
Type | Description |
---|---|
System.Boolean | True if changes were saved successfully; False if no changes were saved. |
OnScrollInView(GridScrollCurrentCellReason)
Called from GridCurrentCell.ScrollInView to determine if cell should be scrolled into view when GridCurrentCell.ScrollInView is called.
Declaration
public virtual bool OnScrollInView(GridScrollCurrentCellReason reason)
Parameters
Type | Name | Description |
---|---|---|
GridScrollCurrentCellReason | reason | The reason for scrolling current cell into view. |
Returns
Type | Description |
---|---|
System.Boolean | True if cell supports scrolling into view. |
OnSetControlText(String)
Called right after ControlText was set.
Declaration
protected virtual void OnSetControlText(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The ControlText |
OnShowDropDown()
This is called from GridCurrentCell.ShowDropDown after BeginEdit has been called.
Declaration
protected virtual void OnShowDropDown()
Remarks
If your renderer supports dropped-down state, the drop-down window should be made visible at this time.
OnStartEditing()
Occurs before the current cell switches into editing mode.
Declaration
protected virtual bool OnStartEditing()
Returns
Type | Description |
---|---|
System.Boolean | True if editing the cell is allowed; false otherwise. |
Remarks
The grid will switch into editing mode when the user presses a key while the cell is not in editing mode or when you call BeginEdit(). You can cancel the operation by overriding this method and returning false.
You can find out about the current cell's position by querying the RowIndex and ColIndex properties of the CurrentCell object in GridControlBase.
See MoveTo(Int32, Int32, GridSetCurrentCellOptions, Boolean) for a discussion about the order of events you receive when the current cell is moved.
OnValidate()
This method is called from GridCurrentCell.Validate after GridCurrentCell.Validating event has been fired. The default version checks if the active text fits any criteria as specified in the style object: It can be parsed into a cell value and meets GridCellValidateValueInfo criteria.
Declaration
protected virtual bool OnValidate()
Returns
Type | Description |
---|---|
System.Boolean | True if the modified text is valid; False otherwise. |
Remarks
If you throw an exception in your override, the exception message will be stored in the GridCurrentCell.ErrorMessage string and if specified, a message box will be shown.
OnValidate will call ValidateString, which you can also override.
OnValidated()
This method is called from GridCurrentCell.Validate after the current cell contents were successfully validated and before GridCurrentCell.Validated event is. fired.
Declaration
protected virtual void OnValidated()
Paste()
Called when user initiates a clipboard paste and the grid has a current cell but no range is selected.
Declaration
public virtual bool Paste()
Returns
Type | Description |
---|---|
System.Boolean | True if successful; False if failed. |
PerformLayout(Int32, Int32)
Calculates the CellLayout for the specified cell using cell state information as specified in the style object.
Declaration
public GridCellLayout PerformLayout(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
Returns
Type | Description |
---|---|
GridCellLayout | The GridCellLayout with layout information. |
PerformLayout(Int32, Int32, GridStyleInfo)
Calculates the CellLayout for the specified cell using cell state information as specified in the style object.
Declaration
public GridCellLayout PerformLayout(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 |
---|---|
GridCellLayout | The GridCellLayout with layout information. |
PerformLayout(Int32, Int32, GridStyleInfo, Rectangle)
Calculates the CellLayout for the specified cell using cell state information as specified in the style object.
Declaration
public GridCellLayout PerformLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle cellRectangle)
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 | cellRectangle | The Rectangle. |
Returns
Type | Description |
---|---|
GridCellLayout | The GridCellLayout with layout information. |
ProcessKeyEventArgs(ref Message)
This is called from GridControlBase.ProcessKeyEventArgs and allows your customized cell renderer to process keyboard events before the GridControlBase gets the actual KeyDown / KeyUp event.
Declaration
protected virtual bool ProcessKeyEventArgs(ref Message m)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Message | m | The System.Windows.Forms.Message with data of the keyboard event. |
Returns
Type | Description |
---|---|
System.Boolean | True if key was handled; False otherwise. |
ProcessMouseWheel(MouseEventArgs)
Lets you customize and redirect mouse wheel behavior to a cell renderer, e.g. if you have a drop-down displayed. Returns true if parent grid should not be scrolled; False if parent grid should scroll.
Declaration
public virtual bool ProcessMouseWheel(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.MouseEventArgs | e | The mouse event arguments. |
Returns
Type | Description |
---|---|
System.Boolean | returns False. |
QueryFocusInside()
Determines if this control contains focus. Override this method if you want to show drop-down windows and indicate the control has not lost focus when the drop-down is shown.
Declaration
public virtual bool QueryFocusInside()
Returns
Type | Description |
---|---|
System.Boolean | True if the control or any child control has focus; False otherwise. |
RaiseCancelMode(Int32, Int32)
Raises a CellCancelMode event and initiates a call to the virtual OnCancelMode(Int32, Int32) method.
Declaration
public void RaiseCancelMode(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
RaiseClick(Int32, Int32, MouseEventArgs)
Raises a CellClick event and initiates a call to the virtual OnClick(Int32, Int32, MouseEventArgs) method.
Declaration
public void RaiseClick(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. |
RaiseDoubleClick(Int32, Int32, MouseEventArgs)
Raises a CellDoubleClick event and initiates a call to the virtual OnDoubleClick(Int32, Int32, MouseEventArgs) method.
Declaration
public void RaiseDoubleClick(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. |
RaiseGetCursor(Int32, Int32)
This is called from GridClickCellsMouseController or GridSelectCellsMouseController. Returns the cursor to be displayed at the given row or column.
Declaration
public Cursor RaiseGetCursor(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
Returns
Type | Description |
---|---|
System.Windows.Forms.Cursor | returns Cursor |
RaiseHitTest(Int32, Int32, MouseEventArgs, IMouseController)
This is called from GridClickCellsMouseController or GridSelectCellsMouseController. Checks if the mouse is over a cell button element and if the cell is click-able.
Declaration
public int RaiseHitTest(int rowIndex, int colIndex, MouseEventArgs mouseEventArgs, IMouseController controller)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
System.Windows.Forms.MouseEventArgs | mouseEventArgs | A System.Windows.Forms.MouseEventArgs with data about the mouse event. |
IMouseController | controller | The current controller requested to handle this mouse event. |
Returns
Type | Description |
---|---|
System.Int32 | Non-zero hit context value if you request to handle the mouse event; zero if you vote not to handle the mouse event. |
Remarks
Override OnHitTest in your derived cell renderer if you want to catch mouse events.
RaiseMouseDown(Int32, Int32, MouseEventArgs)
Raises a CellMouseDown event and initiates a call to the virtual OnMouseDown(Int32, Int32, MouseEventArgs) method.
Declaration
public void RaiseMouseDown(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 event data. |
RaiseMouseHover(Int32, Int32, MouseEventArgs)
Raises a CellMouseHover event and initiates a call to the virtual OnMouseHoverEnter(Int32, Int32) method.
Declaration
public void RaiseMouseHover(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 event data. |
RaiseMouseHoverEnter(Int32, Int32)
This is called from GridClickCellsMouseController or GridSelectCellsMouseController when HitTest has indicated it wants to receive mouse events and the user has moved the mouse into the cell.
Declaration
public void RaiseMouseHoverEnter(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index of the current cell. |
System.Int32 | colIndex | The column index of the current cell. |
Remarks
See also MouseHoverLeave.
RaiseMouseHoverLeave(Int32, Int32, EventArgs)
Raises a CellMouseHoverLeave event and initiates a call to the virtual OnMouseHoverLeave(Int32, Int32, EventArgs) method.
Declaration
public void RaiseMouseHoverLeave(int rowIndex, int colIndex, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
System.EventArgs | e | An System.EventArgs with event data. |
RaiseMouseMove(Int32, Int32, MouseEventArgs)
Raises a CellMouseMove event and initiates a call to the virtual OnMouseMove(Int32, Int32, MouseEventArgs) method.
Declaration
public void RaiseMouseMove(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 event data. |
RaiseMouseUp(Int32, Int32, MouseEventArgs)
Raises a CellMouseUp event and initiates a call to the virtual OnMouseUp(Int32, Int32, MouseEventArgs) method.
Declaration
public void RaiseMouseUp(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 event data. |
RaiseProcessKeyEventArgs(ref Message)
Calls protected virtual ProcessKeyEventArgs(ref Message) method.
Declaration
public bool RaiseProcessKeyEventArgs(ref Message m)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Message | m | The System.Windows.Forms.Message with data of the keyboard event. |
Returns
Type | Description |
---|---|
System.Boolean | True if key was handled; False otherwise. |
RemoveButton(GridCellButton)
Removes a GridCellButton from the cell renderer's list of cell buttons.
Declaration
protected void RemoveButton(GridCellButton button)
Parameters
Type | Name | Description |
---|---|---|
GridCellButton | button | The GridCellButton to remove. |
RemoveMargins(Rectangle, GridStyleInfo)
Removes TextMargins from the specified client bounds.
Declaration
protected virtual Rectangle RemoveMargins(Rectangle clientRectangle, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Rectangle | clientRectangle | The Rectangle |
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | A System.Drawing.Rectangle with the bounds. |
ReplaceSel(String)
Replaces the selected text in the current cell.
Declaration
public virtual void ReplaceSel(string replacement)
Parameters
Type | Name | Description |
---|---|---|
System.String | replacement | The string to replace the current selected text. |
ReplaceText(String, String, Int32, Int32, GridFindTextOptions, Boolean)
Searches the specified text and optionally moves the current cell to the cell if the text was found.
Declaration
public virtual bool ReplaceText(string find, string replace, int rowIndex, int colIndex, GridFindTextOptions options, bool bSetCell)
Parameters
Type | Name | Description |
---|---|---|
System.String | find | The text to be searched. |
System.String | replace | The replace text. |
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
GridFindTextOptions | options | Search criteria. |
System.Boolean | bSetCell | True if current cell should be moved after text was found. |
Returns
Type | Description |
---|---|
System.Boolean | True if text was found; False otherwise. |
ResetCellLayout()
Reset window coordinates (cell bounds) of the cell.
Declaration
public void ResetCellLayout()
ResetControlText()
Resets the ControlText to its original state.
Declaration
public void ResetControlText()
ResetControlValue()
Resets the cell value of the current cell to its original state.
Declaration
public void ResetControlValue()
SetControl(Control)
Sets a reference to the associated control.
Declaration
protected void SetControl(Control control)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control | The Control to be associated with. |
SetControlValue(Object, Boolean)
Sets the cell value for the current cell and optionally initializes the ControlText based on the value.
Declaration
protected void SetControlValue(object value, bool initControlText)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The cell value. |
System.Boolean | initControlText | True if InitializeControlText should be called. |
SetEditState(Object)
Restores previously retrieved editing state information from a GetEditState() call.
Declaration
public virtual void SetEditState(object state)
Parameters
Type | Name | Description |
---|---|---|
System.Object | state | The cell-type specific object with editing state information. |
Remarks
You need to override this method in a derived cell-type class. Otherwise calling this method will have no effect.
ShouldDrawEditing(Int32, Int32)
Determines if the cell at the specified row and column should be drawn in "editing" mode.
Declaration
public bool ShouldDrawEditing(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 if the cell should be drawn in "editing" mode; False otherwise. |
ShouldDrawFocused(Int32, Int32)
Determines if the cell at the specified row and column should be drawn "focused".
Declaration
public bool ShouldDrawFocused(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 if the cell should be drawn "focused". |
ShouldRefreshCurrentCell()
Called to determine whether the cell needs to be repainted when it becomes the active current cell.
Declaration
public virtual bool ShouldRefreshCurrentCell()
Returns
Type | Description |
---|---|
System.Boolean | True if cell needs to be repainted; False otherwise. |
ToString()
Returns a System.String that represents the current System.Object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String that represents the current System.Object. |
Overrides
UnwireModel(GridCellModelBase)
Override this method if you are subscribing to events from a cell model. It is called before the reference to the cell model is reset or when dispose has been called.
Declaration
protected virtual void UnwireModel(GridCellModelBase cellModel)
Parameters
Type | Name | Description |
---|---|---|
GridCellModelBase | cellModel | The GridCellModelBase. |
UpdateControlValue()
Forces the ControlValue to reflect current control contents. Call this method if you want to know the value that will be saved in CellValue if user would accept current cells contents.
Declaration
public virtual void UpdateControlValue()
Remarks
This method requires that ControlText contains most recent value. Override this method and derived cell renderers if you need to get the text from the embedded control.
TextBoxCellRenderer does for example get the value from TextBoxText instead.
ValidateString(String)
Called from OnValidate and checks whether the specified text is valid.
Declaration
public virtual bool ValidateString(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | Text to be validated. |
Returns
Type | Description |
---|---|
System.Boolean | True if text if valid; False otherwise. |
Remarks
This also works for limiting the keyboard input, e.g. only digits. Called after the user pressed a key and before it is accepted.
Examples
Don't allow "-" to be typed.
public override bool ValidateString(string text)
{
TraceUtil.TraceCurrentMethodInfoIf(Switches.CellRenderer.TraceVerbose, text);
if (text.IndexOf("-") != -1)
return false;
return true;
}
WireModel(GridCellModelBase)
Override this method if you are subscribing to events from a cell model. It is called after the reference to the cell model has been initialized.
Declaration
protected virtual void WireModel(GridCellModelBase cellModel)
Parameters
Type | Name | Description |
---|---|---|
GridCellModelBase | cellModel | The GridCellModelBase. |
Explicit Interface Implementations
IPopupItem.GetPopupParentControl()
Declaration
Control IPopupItem.GetPopupParentControl()
Returns
Type |
---|
System.Windows.Forms.Control |
IPopupParent.GetBorderOverlapCue(PopupRelativeAlignment)
Declaration
Point[] IPopupParent.GetBorderOverlapCue(PopupRelativeAlignment relativeAlignment)
Parameters
Type | Name | Description |
---|---|---|
PopupRelativeAlignment | relativeAlignment |
Returns
Type |
---|
System.Drawing.Point[] |
IPopupParent.GetLocationForPopupAlignment(PopupRelativeAlignment, out PopupRelativeAlignment)
Declaration
Point IPopupParent.GetLocationForPopupAlignment(PopupRelativeAlignment prevAlign, out PopupRelativeAlignment newAlign)
Parameters
Type | Name | Description |
---|---|---|
PopupRelativeAlignment | prevAlign | |
PopupRelativeAlignment | newAlign |
Returns
Type |
---|
System.Drawing.Point |
IPopupParent.IsRightToLeft
Gets a value indicates whether control's elements should be rendered right-to-left.
Declaration
bool IPopupParent.IsRightToLeft { get; }
Returns
Type |
---|
System.Boolean |