Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Erstellt eine Befehlsleiste, die gespeichert und beim nächsten Start der Umgebung bereitgestellt wird.
Namespace: EnvDTE80
Assembly: EnvDTE80 (in EnvDTE80.dll)
Syntax
'Declaration
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
Parameter
Name
Typ: StringErforderlich. Ein Name für die neue Befehlsleiste.
Type
Typ: vsCommandBarTypeErforderlich. Eine vsCommandBarType-Konstante, die den Befehlsleistentyp bestimmt:
CommandBarParent
Typ: ObjectOptional. Ein CommandBar-Objekt, dem die neue Befehlsleiste hinzugefügt werden soll. (Dieser Parameter ist jedoch erforderlich, wenn Type vsCommandBarTypeMenu ist.)
Position
Typ: Int32Optional. Die Indexposition auf der Befehlsleiste (beginnend bei Eins), an der die neue Befehlsleiste eingefügt werden soll.
Rückgabewert
Typ: Object
Ein CommandBar-Objekt.
Hinweise
Die neue Befehlsleiste steht unabhängig davon, ob das Add-In geladen wird, bei allen neuen Sitzungen in der Umgebung zur Verfügung.
Beispiele
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-Sicherheit
- Volle Vertrauenswürdigkeit für den unmittelbaren Aufrufer. Dieser Member kann von nur teilweise vertrauenswürdigem Code nicht verwendet werden. Weitere Informationen finden Sie unter Verwenden von Bibliotheken aus teilweise vertrauenswürdigem Code.