Compartilhar via


Método Commands2.RemoveCommandBar

Remove uma barra de comandos que é criado com o método de AddCommandBar .

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

Sintaxe

'Declaração
Sub RemoveCommandBar ( _
    CommandBar As Object _
)
void RemoveCommandBar(
    Object CommandBar
)
void RemoveCommandBar(
    [InAttribute] Object^ CommandBar
)
abstract RemoveCommandBar : 
        CommandBar:Object -> unit
function RemoveCommandBar(
    CommandBar : Object
)

Parâmetros

  • CommandBar
    Tipo: Object

    Obrigatório. O objeto de CommandBar a remover.

Comentários

Este método falhar se a barra de comandos é intrinsecamente (built-in) para o ambiente.

Exemplos

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)

Sub de extremidade

Segurança do .NET Framework

Consulte também

Referência

Commands2 Interface

Namespace EnvDTE80