Metodo Commands2.Item (Object, Int32)

Restituisce un membro indicizzato di una raccolta.

Spazio dei nomi:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Sintassi

'Dichiarazione
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

Parametri

  • index
    Tipo: System.Object
    obbligatorio.Un indice assoluto, stringa di GUID, o il nome completo del comando.
  • ID
    Tipo: System.Int32
    facoltativo.L'ID di comando nel set specificato di comando.

Valore restituito

Tipo: EnvDTE.Command
In Command oggetto.

Note

se index è un indice assoluto (un tipo long), è solo significativo per la ripetizione sui controlli da 1 a più livelli.Non è possibile salvare il valore assoluto di un comando e utilizzarlo in un secondo momento per accedere al comando.

se index è una stringa di GUID, indicherà che un set e si di comando forniscano ID argomento per identificare il comando il set.

Se si immette ID l'argomento e il primo argomento è una stringa, quindi indexl'argomento deve essere una stringa di GUID che identificano un comando impostato.se index è una stringa e non esiste alcuna ID argomento, quindi index deve essere il nome completo di un comando.se index è di tipo long, quindi ID viene ignorato.

Esempi

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

Sicurezza di .NET Framework

Vedere anche

Riferimenti

Commands2 Interfaccia

Overload Item

Spazio dei nomi EnvDTE80