다음을 통해 공유


Commands2.AddNamedCommand2 메서드

환경에 저장되어 다음에 환경을 시작하면 사용할 수 있는 명명된 명령을 만듭니다. 이 명령은 환경을 시작할 때 추가 기능을 로드하지 않아도 사용할 수 있습니다.

네임스페이스:  EnvDTE80
어셈블리:  EnvDTE80(EnvDTE80.dll)

구문

‘선언
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
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
)
abstract AddNamedCommand2 : 
        AddInInstance:AddIn * 
        Name:string * 
        ButtonText:string * 
        Tooltip:string * 
        MSOButton:bool * 
        Bitmap:Object * 
        ContextUIGUIDs:Object[] byref * 
        vsCommandStatusValue:int * 
        CommandStyleFlags:int * 
        ControlType:vsCommandControlType -> Command 
function AddNamedCommand2(
    AddInInstance : AddIn, 
    Name : String, 
    ButtonText : String, 
    Tooltip : String, 
    MSOButton : boolean, 
    Bitmap : Object, 
    ContextUIGUIDs : Object[], 
    vsCommandStatusValue : int, 
    CommandStyleFlags : int, 
    ControlType : vsCommandControlType
) : Command

매개 변수

  • AddInInstance
    형식: EnvDTE.AddIn
    필수적 요소로서,AddIn 개체가 새 명령을 추가합니다.
  • Name
    형식: System.String
    필수적 요소로서,새 명령의 약식 이름입니다.AddNamedCommand2는 이 이름 앞에 **Addins.Progid.**를 추가하여 고유한 이름을 만듭니다.
  • ButtonText
    형식: System.String
    필수적 요소로서,아이콘 대신 이름으로 표시되는 단추에 명령을 바인딩하는 경우 사용하는 이름입니다.
  • Tooltip
    형식: System.String
    필수적 요소로서,새 명령에 연결된 컨트롤 위에 마우스 포인터를 두는 경우 표시되는 텍스트입니다.
  • MSOButton
    형식: System.Boolean
    필수적 요소로서,비트맵 매개 변수를 해석하는 방법을 나타냅니다.
    값이 true인 경우 Bitmap은 Microsoft Office 비트맵의 ID입니다.
    MSOButton이 false인 경우 Bitmap은 다음 중 하나일 수 있습니다.
    - Bitmap
    - Icon
    - IPicture
    - 추가 기능에서 제공하는 16x16 비트맵 리소스의 ID(아이콘 리소스가 아님)입니다.Visual Studio는 추가 기능의 위성 DLL에서 먼저 찾습니다.해당 위치에서 리소스를 찾지 못하면 추가 기능 DLL이 검색됩니다.
  • Bitmap
    형식: System.Object
    선택적 요소로서,단추에 표시되는 비트맵의 ID입니다.MSOButton를 참조하십시오.
  • ContextUIGUIDs
    형식: array<System.Object[]%
    선택적 요소로서,명령을 표시하는 환경 컨텍스트(디버그 모드, 디자인 모드 등)를 결정하는 GUID의 SafeArray입니다.vsCommandDisabledFlags를 참조하십시오.
  • vsCommandStatusValue
    형식: System.Int32
    선택적 요소로서,ContextUIGUIDs를 제공했지만 모두 활성화되지 않은 경우 비활성 상태를 표시하는 방법(명령을 아예 표시하지 않거나 회색으로 표시)을 결정합니다.
  • CommandStyleFlags
    형식: System.Int32
    선택적 요소로서,ContextUIGUIDs를 제공했지만 지정된 컨텍스트가 현재 모두 활성화되지 않은 경우 명령 상태를 확인합니다.이 매개 변수는 항상 vsCommandStatusSupported를 포함해야 합니다.이 매개 변수가 vsCommandStatusEnabled도 포함하면 명령을 사용할 수 있습니다.

반환 값

형식: EnvDTE.Command
작성하여 이름을 지정한 명령입니다.

설명

MSO 단추의 비트맵 ID 값을 가져오는 방법에 대한 자세한 내용은 Listing Button Faces in the Command Bar for the Microsoft Office System을 참조하십시오.

추가 기능으로 QueryStatus 메서드에 응답하여 나중에 ButtonText 이름을 변경할 수 있습니다. 텍스트가 #으로 시작한다면 나머지 문자열은 추가 기능의 등록된 위성 DLL 리소스 ID를 나타내는 정수입니다.

ContextUIGUIDs 매개 변수와 vsCommandStatusValue 매개 변수는 추가 기능이 로드되지 않아 QueryStatus 메서드에 응답할 수 없는 경우 사용됩니다. ContextUIGUIDs가 비어 있으면 추가 기능이 로드되고 QueryStatus에 응답할 수 있을 때까지 명령이 활성 상태입니다.

추가 기능은 IDTCommandTarget 인터페이스를 통해 호출 알림을 수신할 수 있습니다. IDTExtensibility2 인터페이스의 OnConnection 메서드를 사용하여 단추를 추가할 수 있습니다.

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

Commands2 인터페이스

EnvDTE80 네임스페이스