Metoda Commands2.Item —

Zwraca indeksowanych członkiem kolekcji.

Przestrzeń nazw:  EnvDTE80
Zestaw:  EnvDTE80 (w EnvDTE80.dll)

Składnia

'Deklaracja
Function Item ( _
    index As Object, _
    ID As Integer _
) As Command
Command Item(
    Object index,
    int ID
)
Command^ Item(
    [InAttribute] Object^ index, 
    [InAttribute] int ID
)
abstract Item : 
        index:Object * 
        ID:int -> Command
function Item(
    index : Object, 
    ID : int
) : Command

Parametry

  • index
    Typ: Object

    Wymagany.Bezwzględne indeksu, ciągu identyfikatora GUID lub Pełna nazwa polecenia.

  • ID
    Typ: Int32

    Opcjonalnie.Ustaw identyfikator polecenia w określonego polecenia.

Wartość zwracana

Typ: Command
Obiekt Command.

Uwagi

Jeśli index jest indeks bezwzględne (długo), to jest przydatny tylko do iteracji poleceń od 1 do n.Nie można zapisać bezwzględne Indeks polecenia i później użyć do udostępniania tego polecenia.

Jeśli index jest ciągiem identyfikatora GUID, a następnie oznacza zestaw poleceń oraz musi dostarczyć ID argument do identyfikowania polecenia w zestawie.

Jeśli podasz ID argument i pierwszy argument jest ciągiem, a następnie index argument musi być ciąg identyfikatora GUID, który identyfikuje zestaw poleceń.Jeśli index jest ciągiem i ma nie ID argument, następnie index musi być pełną nazwą polecenia.Jeśli index następnie jest długi, ID jest ignorowana.

Przykłady

Sub ItemExample()
   Dim cmds As Commands
   Dim cmd As Command

   ' Set references to the Commands collection and the File.NewFile 
   ' command.
   cmds = DTE.Commands
   cmd = cmds.Item("File.NewFile")

   ' Assign the command (File.NewFile) globally to the F2 key.
   ' Because you cannot programmatically change the default keyboard
   ' mapping scheme settings, you must first make a copy of the Default 
   ' Settings for the Keyboard Mapping Scheme.
   cmd.Bindings = "Global::f2"
End Sub

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

Commands2 Interfejs

Przestrzeń nazw EnvDTE80