RichEditControl.EncryptDocumentFormShowing Event

Occurs before the Encrypt Document Dialog is invoked.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.XtraRichEdit.v20.1.dll

Declaration

public event EncryptDocumentFormShowingEventHandler EncryptDocumentFormShowing
Public Event EncryptDocumentFormShowing As EncryptDocumentFormShowingEventHandler

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.

Remarks

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()
    {
        InitializeComponent();
        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();
        frm.Dispose();
        e.Handled = true;
    }
}
See Also