Commands.Item أسلوب

إرجاع المفهرسة Commandكائن.

مساحة الاسم:  EnvDTE
التجميع:  EnvDTE (في EnvDTE.dll)

بناء الجملة

'إقرار
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

المعلمات

  • index
    النوع: System.Object
    مطلوبة.فهرس مطلق أو سلسلة معرّف فريد عالمي الخاص بالأمر الاسم الكامل.
  • ID
    النوع: System.Int32
    اختياري.المعرف الأمر في الأمر المحدد التعيين.

القيمة المُرجعة

النوع: EnvDTE.Command
كائن Command .

ملاحظات

إذا indexهو فهرس مطلق (طويل)، فإنه هو له معنى فقط للتكرار عبر الأوامر من 1 إلى n. لا يمكنك حفظ الفهرس الخاص بالأمر المطلق و استخدم فيما بعد للوصول إلى هذا الأمر.

إذا indexهو سلسلة المعرف الفريد عمومي، ثم تشير إلى التعيين أوامر ويجب عليك تقديم IDوسيطة للتعرف على الأمر في التعيين.

If you supply the ID argument and the first argument is a string, then the indexargument must be a GUID string that identifies a command set. إذا indexهو سلسلة وهناك هو لا ، ثم IDوسيطة indexيجب أن تكون أحد الأوامر كاملة. إذا indexهو طويل، ثم IDهو تجاهل.

أمثلة

' Macro code.
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

أمن NET Framework.

راجع أيضًَا

المرجع

Commands واجهة

Commands الأعضاء

EnvDTE مساحة الاسم