Back to Devexpress

SearchFormShowingEventArgs Class

windowsforms-devexpress-dot-xtrarichedit-3064f91f.md

latest4.8 KB
Original Source

SearchFormShowingEventArgs Class

Provides data for the RichEditControl.SearchFormShowing event.

Namespace : DevExpress.XtraRichEdit

Assembly : DevExpress.XtraRichEdit.v25.2.dll

NuGet Package : DevExpress.Win.RichEdit

Declaration

csharp
public class SearchFormShowingEventArgs :
    FormShowingEventArgs
vb
Public Class SearchFormShowingEventArgs
    Inherits FormShowingEventArgs

SearchFormShowingEventArgs is the data class for the following events:

Remarks

The RichEditControl.SearchFormShowing event occurs before the Find and Replace dialog is invoked. The SearchFormShowingEventArgs class introduces the SearchFormShowingEventArgs.ControllerParameters property that specifies the information to be displayed in the dialog.

Note, that SearchFormShowingEventArgs objects are automatically created, initialized and passed to the RichEditControl.SearchFormShowing event handlers.

Example

This example demonstrates how handle the RichEditControl.SearchFormShowing event to replace the standard Find and Replace dialog with a custom dialog.

csharp
private void richEditControl1_SearchFormShowing(object sender, SearchFormShowingEventArgs e)
{
    string curWord = richEditControl.Document.GetText(richEditControl.Document.Selection);
    using (MySearchTextForm form = new MySearchTextForm(e.ControllerParameters, curWord))
    {
        e.DialogResult = form.ShowDialog();
        e.Handled = true;
    }
}
vb
Private Sub richEditControl1_SearchFormShowing(ByVal sender As Object, ByVal e As SearchFormShowingEventArgs)
Dim curWord As String = richEditControl.Document.GetText(richEditControl.Document.Selection)
Using form As New MySearchTextForm(e.ControllerParameters, curWord)
    e.DialogResult = form.ShowDialog()
    e.Handled = True
End Using
End Sub
csharp
using System.Drawing;
using DevExpress.XtraRichEdit.Forms;

namespace CustomDialogs
{
    public partial class MySearchTextForm : SearchTextForm
    {
        public MySearchTextForm(SearchFormControllerParameters controllerParameters, string searchWord)
            : base(controllerParameters)
        {
            lblFndDirection.Location = new Point (lblFndDirection.Location.X - 10, lblFndDirection.Location.Y);
            lblFndDirection.Text = "Direction:";
            cbFndSearchString.Text = searchWord;
            chbFndRegex.Enabled = false;
        }
    }
}
vb
Imports Microsoft.VisualBasic
Imports System.Drawing
Imports DevExpress.XtraRichEdit.Forms

Namespace CustomDialogs
    Partial Public Class MySearchTextForm
        Inherits SearchTextForm
        Public Sub New(ByVal controllerParameters As SearchFormControllerParameters, ByVal searchWord As String)
            MyBase.New(controllerParameters)
            lblFndDirection.Location = New Point (lblFndDirection.Location.X - 10, lblFndDirection.Location.Y)
            lblFndDirection.Text = "Direction:"
            cbFndSearchString.Text = searchWord
            chbFndRegex.Enabled = False
        End Sub
    End Class
End Namespace

Inheritance

Object EventArgs ShowFormEventArgs FormShowingEventArgs SearchFormShowingEventArgs

See Also

SearchFormShowingEventArgs Members

DevExpress.XtraRichEdit Namespace