Skip to main content

ShowFormEventArgs.Handled Property

Gets or sets whether an event was handled. If it was handled, the default actions are not required.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.XtraRichEdit.v23.2.dll

NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.RichEdit, DevExpress.Win.TreeMap

Declaration

public bool Handled { get; set; }

Property Value

Type Description
Boolean

true if it was handled and the default dialog doesn’t need to be shown; otherwise, false.

Remarks

If the event parameter’s Handled property is set to true within a handler, then the default dialog will not be shown. Otherwise, the default dialog will be invoked after the custom actions within the handler have been performed.

Use the Handled property set to true with the ShowFormEventArgs.DialogResult parameter, to substitute a standard dialog with a custom one.

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