2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
EditControl has default embedded ContextMenu. This ContextMenu supports to add/remove the ContextMenuItem. It can be achieved using below functions.
AddContextMenuItem: Used to add the ContextMenuItem.
RemoveContextMenuItem: Used to remove the ContextMenuItem from the Embedded ContextMenu by passing the below corresponding ContextMenuItem Text. Please make use of the below ContextMenuItem Text.
The following code demonstrates the same.
C# // Handle the FillMenu event which is called each time the context menu is displayed. this.editControl1.ContextMenuManager.FillMenu += ContextMenuManager_FillMenu; //Add ContextMenuItem this.editControl1.ContextMenuManager.ContextMenuProvider.AddContextMenuItem("&Find", show1); this.editControl1.ContextMenuManager.ContextMenuProvider.AddContextMenuItem("&Replace", ShowReplaceDialog); this.editControl1.ContextMenuManager.ContextMenuProvider.AddContextMenuItem("&Goto", ShowGoToDialog); //Remove ContextMenu Item this.editControl1.ContextMenuManager.ContextMenuProvider.RemoveContextMenuItem("&Edit"); this.editControl1.ContextMenuManager.ContextMenuProvider.RemoveContextMenuItem("&Options…"); this.editControl1.ContextMenuManager.ContextMenuProvider.RemoveContextMenuItem("&Save"); this.editControl1.ContextMenuManager.ContextMenuProvider.RemoveContextMenuItem("Save &As...");
VB 'Raise the event that used to set Add/Remove the ContextmenuItem AddHandler Me.editControl1.ContextMenuManager.FillMenu, AddressOf ContextMenuManager_FillMenu ''Add ContextMenuItem Me.editControl1.ContextMenuManager.ContextMenuProvider.AddContextMenuItem("&Find", AddressOf show1) Me.editControl1.ContextMenuManager.ContextMenuProvider.AddContextMenuItem("&Replace", AddressOf ShowReplaceDialog) Me.editControl1.ContextMenuManager.ContextMenuProvider.AddContextMenuItem("&Goto", AddressOf ShowGoToDialog) 'Remove ContextMenu Item Me.editControl1.ContextMenuManager.ContextMenuProvider.RemoveContextMenuItem("&New") Me.editControl1.ContextMenuManager.ContextMenuProvider.RemoveContextMenuItem("&Options...") Me.editControl1.ContextMenuManager.ContextMenuProvider.RemoveContextMenuItem(“Cop&y”) Me.editControl1.ContextMenuManager.ContextMenuProvider.RemoveContextMenuItem("Save &As...")
Screenshot
Figure 1: Default ContextMenu.
Figure 2: After Remove Save As... from File ContextMenu Item.
Samples:
|
2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.