Class GridFindReplaceDialogSink
Provides a default implementation of a IGridFindReplaceDialogSink for a grid control.
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public class GridFindReplaceDialogSink : GridSubComponent, IDisposable, IGridFindReplaceDialogSink
Examples
The following example demonstrates how to enable a grid control for find and replace support:
GridFindReplaceDialogSink findReplaceDialogSink;
public GridFindReplaceDialogSink GridFindReplaceDialogSink
{
get
{
if (findReplaceDialogSink == null)
{
findReplaceDialogSink = new GridFindReplaceDialogSink(this);
}
return findReplaceDialogSink;
}
}
protected override void OnCurrentCellActivated(EventArgs e)
{
GridFindReplaceDialog.ResetFindLocation();
base.OnCurrentCellActivated(e);
}
protected override void OnControlGotFocus()
{
GridFindReplaceDialog.SetActiveSinkIfVisible(GridFindReplaceDialogSink);
base.OnControlGotFocus();
}
// to show the dialog:
GridFindReplaceDialog frDialog = GridFindReplaceDialog.Instance;
frDialog.SetState(grid.GridFindReplaceDialogSink, "", false);
frDialog.Show();
Dim findReplaceDialogSink As GridFindReplaceDialogSink
Public ReadOnly Property GridFindReplaceDialogSink() As GridFindReplaceDialogSink
Get
If findReplaceDialogSink Is Nothing Then
findReplaceDialogSink = New GridFindReplaceDialogSink(Me)
End If
Return findReplaceDialogSink
End Get
End Property
Protected Overrides Sub OnCurrentCellActivated(e As EventArgs)
GridFindReplaceDialog.ResetFindLocation()
MyBase.OnCurrentCellActivated(e)
End Sub 'OnCurrentCellActivated
Protected Overrides Sub OnControlGotFocus()
GridFindReplaceDialog.SetActiveSinkIfVisible(GridFindReplaceDialogSink)
MyBase.OnControlGotFocus()
End Sub 'OnEnter
' to show the dialog:
Dim frDialog As GridFindReplaceDialog = GridFindReplaceDialog.Instance
frDialog.SetState(grid.GridFindReplaceDialogSink, "", False)
frDialog.Show()
Constructors
GridFindReplaceDialogSink(GridControlBase)
Constructs a GridFindReplaceDialogSink and associates it with a grid control.
Declaration
public GridFindReplaceDialogSink(GridControlBase grid)
Parameters
Type | Name | Description |
---|---|---|
GridControlBase | grid | The grid control this object operates on. |
Methods
Find(GridFindReplaceEventArgs)
Finds the text with the specified criteria.
Declaration
public virtual object Find(GridFindReplaceEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridFindReplaceEventArgs | e | Text and search criteria. |
Returns
Type | Description |
---|---|
System.Object | The location info (typically a GridRangeInfo) or NULL if not found. |
FindInRange(GridFindReplaceEventArgs, GridRangeInfo, GridRangeInfo, GridRangeInfo)
Finds the in range.
Declaration
protected virtual GridRangeInfo FindInRange(GridFindReplaceEventArgs find, GridRangeInfo selRange, GridRangeInfo start, GridRangeInfo end)
Parameters
Type | Name | Description |
---|---|---|
GridFindReplaceEventArgs | find | The GridFindReplaceEventArgs instance containing the event data. |
GridRangeInfo | selRange | The selection grid range. |
GridRangeInfo | start | The start grid range. |
GridRangeInfo | end | The end grid range. |
Returns
Type | Description |
---|---|
GridRangeInfo | returns GridRangeInfo |
GetNextCell(GridRangeInfo, ref Int32, ref Int32, Boolean, Boolean)
Gets the next cell.
Declaration
public static bool GetNextCell(GridRangeInfo rg, ref int nRow, ref int nCol, bool bSortByRow, bool searchUp)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | rg | The grid range info. |
System.Int32 | nRow | The row index |
System.Int32 | nCol | The column index. |
System.Boolean | bSortByRow | if set to |
System.Boolean | searchUp | if set to |
Returns
Type | Description |
---|---|
System.Boolean | returns the Boolean value |
GetScreenRect(Object)
Returns the screen bounds for the selection object. The find and replace dialog calls this method to ensure that it does not hide the current selected text after a successful find operation.
Declaration
public virtual Rectangle GetScreenRect(object lc)
Parameters
Type | Name | Description |
---|---|---|
System.Object | lc | The location object, typically a GridRangeInfo. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | The bounds in screen coordinates. |
Replace(GridFindReplaceEventArgs)
Replaces the text with the specified criteria.
Declaration
public virtual object Replace(GridFindReplaceEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridFindReplaceEventArgs | e | Text and search criteria. |
Returns
Type | Description |
---|---|
System.Object | The location info (typically a GridRangeInfo) or NULL if not found. |
ReplaceAll(GridFindReplaceEventArgs)
Replace the text in all cells with the specified criteria.
Declaration
public virtual void ReplaceAll(GridFindReplaceEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridFindReplaceEventArgs | e | Text and search criteria. |
ShowInfoMessage(String, String)
Displays a warning message.
Declaration
public virtual void ShowInfoMessage(string msg, string category)
Parameters
Type | Name | Description |
---|---|---|
System.String | msg | The message text. |
System.String | category | The dialog title. |