Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

SearchFormShowingEventArgs Class

Provides data for the RichEditControl.SearchFormShowing event.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.XtraRichEdit.v24.2.dll

NuGet Package: DevExpress.Win.RichEdit

#Declaration

public class SearchFormShowingEventArgs :
    FormShowingEventArgs

#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.

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;
    }
}
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;
        }
    }
}

#Inheritance

See Also