The event handler receives an argument of type SearchFormShowingEventArgs containing data related to this event.
Handle the SearchFormShowing event to perform the required actions before a search form is displayed. Use the DevExpress.XtraRichEdit.SearchFormShowingEventArgs.ActivePage property of the event's argument to determine what tab is active on the search form - Find or Replace.

Example
This example demonstrates how to replace the standard Find and Replace dialog with a custom one via the SearchFormShowing event.
Form1.cs |
private void richEditControl1_SearchFormShowing(object sender, SearchFormShowingEventArgs e)
{
string curWord = richEditControl1.Document.GetText(richEditControl1.Document.Selection);
MySearchTextForm form = new MySearchTextForm(e.ControllerParameters, curWord);
e.DialogResult = form.ShowDialog();
e.Handled = true;
}
|
MySearchForm.cs |
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;
}
}
}
|
MySearchForm.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
|
Form1.vb |
Private Sub richEditControl1_SearchFormShowing(ByVal sender As Object, ByVal e As SearchFormShowingEventArgs) Handles richEditControl1.SearchFormShowing
Dim curWord As String = richEditControl1.Document.GetText(richEditControl1.Document.Selection)
Dim form As New MySearchTextForm(e.ControllerParameters, curWord)
e.DialogResult = form.ShowDialog()
e.Handled = True
End Sub
|