Commands.RemoveCommandBar (Método)
Quita una barra de comandos creada con el método AddCommandBar.
Espacio de nombres: EnvDTE
Ensamblado: EnvDTE (en EnvDTE.dll)
Sintaxis
'Declaración
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: System.Object
Obligatorio.Objeto CommandBar que se va a quitar.
Comentarios
Este método da un error si la barra de comandos es intrínseca (está integrada) en el entorno.
El objeto CommandBar es un miembro del modelo de objetos de Microsoft Office.
Ejemplos
' 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
Seguridad de .NET Framework
- Plena confianza para el llamador inmediato. Un código de confianza parcial no puede utilizar este miembro. Para obtener más información, vea Utilizar bibliotecas de código que no es de plena confianza.