MenuCommandService Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Implements the IMenuCommandService interface.
public ref class MenuCommandService : IDisposable, System::ComponentModel::Design::IMenuCommandService
public class MenuCommandService : IDisposable, System.ComponentModel.Design.IMenuCommandService
type MenuCommandService = class
interface IMenuCommandService
interface IDisposable
Public Class MenuCommandService
Implements IDisposable, IMenuCommandService
- Inheritance
-
MenuCommandService
- Implements
The MenuCommandService class implements the IMenuCommandService interface, which is the managed interface used to add handlers for menu commands and to define verbs.
The MenuCommandService class is automatically offered by the package class to offer global commands for an entire package, and it is also offered by the Microsoft.VisualStudio.Shell.WindowPane
class to offer commands for the current window. This offering is always done through the service container, so anyone deriving from the package or window pane classes can remove or replace the default implementation of the IMenuCommandService interface.
The MenuCommandService class utilizes several other services. All of these services are optional, so the behavior of the MenuCommandService class degrades if one or more services are missing. The following table shows which services are used and for what purpose.
Service | Purpose |
---|---|
ISelectionService | Used to discover the current selection in order to obtain verbs offered by the currently selected designer. |
IDesignerHost | Used to obtain the designer for the currently selected component, if any. |
Microsoft.VisualStudio.Shell.Interop.IVsUIShell |
Used to notify Visual Studio that the command status has changed. |
Microsoft.VisualStudio.Shell.Interop.IOleComponentUIManager |
Used to show context menus. |
Menu |
Initializes a new instance of the MenuCommandService class. |
Verbs |
Gets a collection of the designer verbs that are currently available. |
Add |
Adds a command handler to the menu command service. |
Add |
Adds a verb to the verb table of the MenuCommandService. |
Dispose() |
Releases all resources used by the MenuCommandService. |
Dispose(Boolean) |
Releases all resources used by the MenuCommandService. |
Ensure |
Ensures that the verb list has been created. |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
Find |
Searches for the MenuCommand associated with the given command ID. |
Find |
Searches for the MenuCommand associated with the given command. |
Get |
Gets the command list for a given GUID. |
Get |
Serves as the default hash function. (Inherited from Object) |
Get |
Gets a reference to the requested service. |
Get |
Gets the Type of the current instance. (Inherited from Object) |
Global |
Invokes the given command with the given parameter on the local form or in the global environment. |
Global |
Invokes the given command on the local form or in the global environment. |
Memberwise |
Creates a shallow copy of the current Object. (Inherited from Object) |
On |
Raises the MenuCommandsChanged event. |
Remove |
Removes the given menu command from the document. |
Remove |
Removes the given verb from the document. |
Show |
Shows the shortcut menu with the given command ID at the given location. |
To |
Returns a string that represents the current object. (Inherited from Object) |
Menu |
Occurs when the status of a menu command has changed. |
Product | Versies |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 5, 6, 7, 8, 9 |
.NET-feedback
.NET is een open source project. Selecteer een koppeling om feedback te geven: