- Online Barcode Generator
- How To
- Buy Now
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 Design
WinForms UI Controls