다음을 통해 공유


Commands.RemoveCommandBar 메서드

AddCommandBar 메서드를 사용하여 만든 명령 모음을 제거합니다.

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

구문

‘선언
Sub RemoveCommandBar ( _
    CommandBar As Object _
)
void RemoveCommandBar(
    Object CommandBar
)
void RemoveCommandBar(
    [InAttribute] Object^ CommandBar
)
abstract RemoveCommandBar : 
        CommandBar:Object -> unit 
function RemoveCommandBar(
    CommandBar : Object
)

매개 변수

설명

이 메서드는 명령 모음이 환경의 내장(기본 제공) 명령 모음이면 실패합니다.

CommandBar 개체는 Microsoft Office 개체 모델의 멤버입니다.

예제

' Macro code.
Imports Microsoft.VisualStudio.CommandBars
Sub RemoveCommandBarExample()
   ' 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.AddControl(cmdbarobj)
   cmds.AddNamedCommand(colAddins.Item(1), "MyCommand", _
   "Button Text", "Some tooltip", True)
   cmds.RemoveCommandBar(cmdbarobj)
End Sub

.NET Framework 보안

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

참고 항목

참조

Commands 인터페이스

EnvDTE 네임스페이스