共用方式為


ModelingWindowPane.GetService Method

Gets the service of the specified type. Override this method to return the custom menu command service

Namespace:  Microsoft.VisualStudio.Modeling.Shell
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.Shell.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.Shell.10.0.dll)

Syntax

'宣告
Protected Overrides Function GetService ( _
    serviceType As Type _
) As Object
protected override Object GetService(
    Type serviceType
)
protected:
virtual Object^ GetService(
    Type^ serviceType
) override
abstract GetService : 
        serviceType:Type -> Object 
override GetService : 
        serviceType:Type -> Object 
protected override function GetService(
    serviceType : Type
) : Object

Parameters

  • serviceType
    Type: System.Type
    The type of menu command service to obtain.

Return Value

Type: System.Object
The service of the specified type. By default, this method returns the following services:IOleCommandTarget, IMenuCommandService, IObjectWithSite, IVsTrackSelectionEx, and IVsWindowFrame. If the type specified is ISelectionService, it returns this window pane. If the type is IVsTrackSelectionEx or IVsWindowFrame, it delegates to the local service provider.

Remarks

For more information about services, see Service Essentials.The following table contains an overview of the menu command services that this method supports.

Menu Command Service

Description

IOleCommandTarget

This interface enables objects and their containers to dispatch commands to one another. For example, an object's toolbars might contain buttons for commands such as Print, Print Preview, Save, New, and Zoom.

IMenuCommandService

This interface provides methods to manage the menu commands that are available in design mode and to show some types of shortcut menus.

ISelectionService

This interface enables element selection.

IObjectWithSite

This interface provides simple objects with a lightweight (lighter than IOleObject) sitting mechanism.

IVsTrackSelectionEx

This interface tracks changes in selection.

IVsWindowFrame

This interface provides access to the shell window frames.

.NET Framework Security

See Also

Reference

ModelingWindowPane Class

Microsoft.VisualStudio.Modeling.Shell Namespace