windowsforms-devexpress-dot-xtrarichedit-dot-richeditcontrol-71a808ab.md
Occurs before the Encrypt Document Dialog is invoked.
Namespace : DevExpress.XtraRichEdit
Assembly : DevExpress.XtraRichEdit.v25.2.dll
NuGet Package : DevExpress.Win.RichEdit
public event EncryptDocumentFormShowingEventHandler EncryptDocumentFormShowing
Public Event EncryptDocumentFormShowing As EncryptDocumentFormShowingEventHandler
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.
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;
}
}
Imports DevExpress.XtraRichEdit.Forms
Class MyEncryptForm
Inherits EncryptDocumentForm
Public Sub New(ByVal control As IRichEditControl, ByVal encryptionInfo As EncryptionInfo)
MyBase.New(control, encryptionInfo)
Me.Text = "Password-Protect this Document"
End Sub
End Class
Public Partial Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
Me.richEditControl1.EncryptDocumentFormShowing += AddressOf RichEditControl1_EncryptDocumentFormShowing
End Sub
Private Sub RichEditControl1_EncryptDocumentFormShowing(ByVal sender As Object, ByVal e As EncryptDocumentFormShowingEventArgs)
Dim frm As MyEncryptForm = New MyEncryptForm(Me.richEditControl1, e.EncryptionInfo)
e.DialogResult = frm.ShowDialog()
frm.Dispose()
e.Handled = True
End Sub
End Class
See Also
How to: Customize the Hyperlink Form
How to: Customize the Find and Replace Dialog in Rich Text Editor for WinForms