Skip to main content
A newer version of this page is available. .

How to: Customize the Search Form

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

View Example

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

    }
}