Commands2.AddCommandBar 메서드

저장되어 다음에 환경을 시작하면 사용할 수 있는 명령 모음을 만듭니다.

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

구문

‘선언
Function AddCommandBar ( _
    Name As String, _
    Type As vsCommandBarType, _
    CommandBarParent As Object, _
    Position As Integer _
) As Object
Object AddCommandBar(
    string Name,
    vsCommandBarType Type,
    Object CommandBarParent,
    int Position
)
Object^ AddCommandBar(
    [InAttribute] String^ Name, 
    [InAttribute] vsCommandBarType Type, 
    [InAttribute] Object^ CommandBarParent, 
    [InAttribute] int Position
)
abstract AddCommandBar : 
        Name:string * 
        Type:vsCommandBarType * 
        CommandBarParent:Object * 
        Position:int -> Object
function AddCommandBar(
    Name : String, 
    Type : vsCommandBarType, 
    CommandBarParent : Object, 
    Position : int
) : Object

매개 변수

  • Name
    형식: String

    필수 요소. 새 명령 모음의 이름입니다.

  • Type
    형식: vsCommandBarType

    필수 요소. 명령 모음의 형식을 결정하는 vsCommandBarType 상수입니다.

  • CommandBarParent
    형식: Object

    선택적 요소. 새 명령 모음이 추가될 CommandBar 개체입니다. Type이 vsCommandBarTypeMenu인 경우에는 필수 요소.

  • Position
    형식: Int32

    선택적 요소. 명령 모음에서 새 명령 모음을 배치할 인덱스 위치로 1부터 시작합니다.

반환 값

형식: Object
CommandBar 개체

설명

추가 기능의 로드 여부에 관계없이 새로운 각 세션에서 새로운 명령 모음을 사용할 수 있습니다.

예제

Imports Microsoft.VisualStudio.CommandBars
Sub AddCommandBarExample()
   ' Before running, you must add a reference to the Office 
   ' typelib to gain access to the CommandBar object. Also, for this 
   ' example to work correctly, there should be an add-in available 
   ' in the Visual Studio environment.
   Dim cmds As Commands
   Dim cmdobj As Command
   Dim customin, customout As Object
   Dim cmdbarobj As CommandBar
   Dim colAddins As AddIns

   ' Set references.
   colAddins = DTE.AddIns()
   cmds = DTE.Commands
   cmdobj = cmds.Item("File.NewFile")

   ' Create a toolbar and add the File.NewFile command to it.
   cmdbarobj = cmds.AddCommandBar("Mycmdbar", vsCommandBarType.vsCommandBarTypeToolbar)
   MsgBox("Commandbar name: " & cmdbarobj.Name)
   cmdobj = cmds.AddNamedCommand(colAddins.Item(1), "mycommand", "mycommand", "tooltip for mycommand", True)
End Sub

.NET Framework 보안

참고 항목

참조

Commands2 인터페이스

EnvDTE80 네임스페이스