windowsforms-devexpress-dot-xtrarichedit-dot-richeditcontrol-0d7c8981.md
You should use the 'PopupMenuShowing' instead
Occurs before a context (popup) menu is created for the control’s document every time a context menu is being invoked.
Namespace : DevExpress.XtraRichEdit
Assembly : DevExpress.XtraRichEdit.v25.2.dll
NuGet Package : DevExpress.Win.RichEdit
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("You should use the 'PopupMenuShowing' instead", false)]
public event PreparePopupMenuEventHandler PreparePopupMenu
<Browsable(False)>
<EditorBrowsable(EditorBrowsableState.Never)>
<Obsolete("You should use the 'PopupMenuShowing' instead", False)>
Public Event PreparePopupMenu As PreparePopupMenuEventHandler
The PreparePopupMenu event's data class is DevExpress.XtraRichEdit.PreparePopupMenuEventArgs.
Handle the PreparePopupMenu event to modify items in the context menu. The current context menu can be accessed via the PopupMenuShowingEventArgs.Menu property.
The following code snippet illustrates how you can add a custom menu command to the context menu.
using DevExpress.XtraRichEdit.API.Native;
// ...
private void richEditControl1_PopupMenuShowing(object sender,
DevExpress.XtraRichEdit.PopupMenuShowingEventArgs e) {
e.Menu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("MyMenu",
new EventHandler(mymenu_Click)));
}
void mymenu_Click(object sender, EventArgs e) {
MessageBox.Show("test");
}
Imports DevExpress.XtraRichEdit.API.Native
' ...
Private Sub richEditControl1_PopupMenuShowing (ByVal sender As Object, _
ByVal e As DevExpress.XtraRichEdit.PopupMenuShowingEventArgs )
e.Menu.Items.Add(New DevExpress.Utils.Menu.DXMenuItem("MyMenu", _
New EventHandler(AddressOf mymenu_Click)))
End Sub
Private Sub mymenu_Click(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show("test")
End Sub
See Also