Context Menu of Dock Control in C# Windows Forms
The Dock Control for Windows Forms provide a separate service to deal with operations of all context menus. It requires registration of the Dock Control and the Context Menu Service. All context menu requests will be passed to the Context Menu service. With the Context Menu feature, developers can create the appropriate menu items, raises several events, modify existed items, and add their own or even cancel the context menu requests.
How to Modify the Exist Context Menus
To modify or customize the exit context menus, developers can reference to the sample below, which shows how to collapse the options of context menu from the DocumentWindow. First we need to get the Context Menu Service and subscribe to the DisplayContextMenu event.
Now it is possible to collapse the Close options of context menu from the DocumentWindow in the DisplayContextMenu event handler:
Names of Context Menu Items
The above C# code snippet use the Name properties of the Context Menu Items rather than the Text property so as to let the users handle the case even when applying a custom DockLocalization provider. The Name properties for the Context Menu Items in the Dock Control include
|
UI Controlsfor Windows Forms .NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI DesignWinForms UI Controls WinForms Buttons UI Control WinForms Calendar UI ControlWinForms Carousel UI ControlWinForms Chart UI ControlWinForms Clock UI ControlCommandBar UI ControlWinForms Dock UI ControlDock - Getting Started Architecture and Features Arrange WindowsFloating WindowsAuto-Hide WindowsContext MenuReDockObject Model Create a Dock WindowCreate WindowRemove WindowAdvanced LayoutTab & CaptionAllowed Dock StatesUser Control and FormsLoad and Save LayoutDock - LocalizationDesktop Alert UI ControlDropDown List UI ControlWinForms Editor UI ControlForms and Dialogs UI ControlWinForms GridView UI ControlWinForms ListView UI ControlWinForms Menu UI ControlWinForms ComboBox UI ControlWinForms PageView UI ControlPanels and Labels UI ControlWinForms Panorama UI ControlWinForms PDFViewer UI ControlWinForms Property Grid UI ControlWinForms Ribbon UI ControlWinForms PivotGrid UI ControlWinForms RichTextBox UI ControlWinForms Rotator UI ControlWinForms Scheduler UI ControlWinForms Shortcuts UI ControlWinForms SpellChecker UI ControlWinForms Track & Status UI ControlWinForms TreeView UI ControlWinForms Wizard UI ControlWinForms Test UI ControlWinForms Theme UI Control |