Skip to main content

RichEditControl.EncryptDocumentFormShowing Event

Occurs before the Encrypt Document Dialog is invoked.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.XtraRichEdit.v24.1.dll

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


public event EncryptDocumentFormShowingEventHandler EncryptDocumentFormShowing

Event Data

The EncryptDocumentFormShowing event's data class is EncryptDocumentFormShowingEventArgs. The following properties provide information specific to this event:

Property Description
DialogResult Gets or sets the return value of a dialog box. Inherited from ShowFormEventArgs.
EncryptionInfo Provides access to the encryption information.
Handled Gets or sets whether an event was handled. If it was handled, the default actions are not required. Inherited from ShowFormEventArgs.
Parent Gets or sets a parent of the form being shown. Inherited from ShowFormEventArgs.


Handle the DocumentProtectionQueryNewPasswordFormShowing event to perform any actions prior to the Encrypt Document dialog being shown. You can substitute the standard dialog with a custom form and set the ShowFormEventArgs.Handled property to true to prevent default event handling.

The code sample below shows how to handle the EncryptDocumentFormShowing event to change the caption of the Encrypt Document dialog.

customize dialog

using DevExpress.XtraRichEdit.Forms;

class MyEncryptForm : EncryptDocumentForm
    public MyEncryptForm(IRichEditControl control, EncryptionInfo encryptionInfo) : base(control, encryptionInfo)
        this.Text = "Password-Protect this Document";
public partial class Form1 : Form
    public Form1()
        this.richEditControl1.EncryptDocumentFormShowing += RichEditControl1_EncryptDocumentFormShowing;

    private void RichEditControl1_EncryptDocumentFormShowing(object sender, EncryptDocumentFormShowingEventArgs e)
        MyEncryptForm frm = new MyEncryptForm(this.richEditControl1, e.EncryptionInfo);
        e.DialogResult = frm.ShowDialog();
        e.Handled = true;
See Also