Udostępnij za pośrednictwem


Commands2.AddNamedCommand2 Method

Creates a named command that is saved by the environment and made available the next time the environment starts, even if the Add-in is not loaded on environment startup.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Syntax

'Declaration
Function AddNamedCommand2 ( _
    AddInInstance As AddIn, _
    Name As String, _
    ButtonText As String, _
    Tooltip As String, _
    MSOButton As Boolean, _
    Bitmap As Object, _
    ByRef ContextUIGUIDs As Object(), _
    vsCommandStatusValue As Integer, _
    CommandStyleFlags As Integer, _
    ControlType As vsCommandControlType _
) As Command
'Usage
Dim instance As Commands2 
Dim AddInInstance As AddIn 
Dim Name As String 
Dim ButtonText As String 
Dim Tooltip As String 
Dim MSOButton As Boolean 
Dim Bitmap As Object 
Dim ContextUIGUIDs As Object()
Dim vsCommandStatusValue As Integer 
Dim CommandStyleFlags As Integer 
Dim ControlType As vsCommandControlType 
Dim returnValue As Command 

returnValue = instance.AddNamedCommand2(AddInInstance, _
    Name, ButtonText, Tooltip, MSOButton, _
    Bitmap, ContextUIGUIDs, vsCommandStatusValue, _
    CommandStyleFlags, ControlType)
Command AddNamedCommand2(
    AddIn AddInInstance,
    string Name,
    string ButtonText,
    string Tooltip,
    bool MSOButton,
    Object Bitmap,
    ref Object[] ContextUIGUIDs,
    int vsCommandStatusValue,
    int CommandStyleFlags,
    vsCommandControlType ControlType
)
Command^ AddNamedCommand2(
    [InAttribute] AddIn^ AddInInstance, 
    [InAttribute] String^ Name, 
    [InAttribute] String^ ButtonText, 
    [InAttribute] String^ Tooltip, 
    [InAttribute] bool MSOButton, 
    [InAttribute] Object^ Bitmap, 
    [InAttribute] array<Object^>^% ContextUIGUIDs, 
    [InAttribute] int vsCommandStatusValue, 
    [InAttribute] int CommandStyleFlags, 
    [InAttribute] vsCommandControlType ControlType
)
function AddNamedCommand2(
    AddInInstance : AddIn, 
    Name : String, 
    ButtonText : String, 
    Tooltip : String, 
    MSOButton : boolean, 
    Bitmap : Object, 
    ContextUIGUIDs : Object[], 
    vsCommandStatusValue : int, 
    CommandStyleFlags : int, 
    ControlType : vsCommandControlType
) : Command

Parameters

  • AddInInstance
    Type: EnvDTE.AddIn

    Required. The AddIn Object is adding the new command.

  • Name
    Type: System.String

    Required. The short form of the name for your new command. AddNamedCommand2 uses the preface, Addins.Progid., to create a unique name.

  • ButtonText
    Type: System.String

    Required. The name to use if the command is bound to a button that is displayed by name rather than by icon.

  • Tooltip
    Type: System.String

    Required. The text displayed when a user hovers the mouse pointer over any control bound to the new command.

  • MSOButton
    Type: System.Boolean

    Required. Indicates whether the named command's button picture is an Office picture. True = button. If MSOButton is False, then Bitmap is the ID of a 16x16 bitmap resource (but not an icon resource) in a Visual C++ resource DLL that must reside in a folder with the language's locale identifier (1033 for English). For information about how to get the bitmap ID values of MSO buttons, see Listing Button Faces in the Command Bar for the Microsoft Office System.

  • Bitmap
    Type: System.Object

    Optional. The ID of a bitmap to display on the button.

  • ContextUIGUIDs
    Type: array<System.Object[]%

    Optional. A SafeArray of GUIDs that determines which environment contexts (that is, debug mode, design mode, and so on) enable the command. See vsCommandDisabledFlags.

  • vsCommandStatusValue
    Type: System.Int32

    Optional. Determines whether the disabled state of the command is invisible or grey when you supply a ContextUIGUIDs and none are currently active.

  • CommandStyleFlags
    Type: System.Int32

    Value from the vsCommandStyle enumeration. Controls the visual style of any UI added for this command.

Return Value

Type: EnvDTE.Command
The named command that was created.

.NET Framework Security

See Also

Reference

Commands2 Interface

Commands2 Members

EnvDTE80 Namespace