مشاركة عبر


كيفية القيام بما يلي: عرض الروابط المفتاح موجود

Bindingsخاصية تتيح لك إلى عرض أو تغيير الروابط الأساسية المقترنة مع الأمر المعين. قراءة هذه خاصية يسترد الروابط الأمر الحالي كـ صفيفة من الكائنات. كل كائن يحتوي على سلسلة تصف التوثيق.

تعيين القيمة إلى Bindingsيعين خاصية واحدة أو المزيد الروابط المفتاح جديد للأمر المحدد. للمزيد من المعلومات، راجع كيفية القيام بما يلي: يربط الأمر إلى المفتاح اختصار مفرد وكيفية القيام بما يلي: يربط الأمر إلى عدة اختصارات لوحة المفاتيح.

ملاحظة

قد تختلف مربعات الحوار وأوامر القائمة التى تشاهدها الان عن تلك الموصوفة في التعليمات اعتماداً على الإعدادات النشطة أو الإصدار الخاص بك. تم تطوير هذه الإجراءات من خلال "إعدادات تطوير عام" النشط. To change your settings, choose Import and Export Settings on the Tools menu. لمزيد من المعلومات، راجع العمل مع إعدادات.

عرض الروابط الأساسية موجود

  1. استخدام ‏‫Visual Studio إضافة-في معالج لإنشاء جديد إضافة-في. اسم مشروع وانقر فوق ‏‏موافق إلى يبدأ معالج.

    لمزيد من في تشكيل حول usفيg برنامج ‏‫Visual Studio-إضافة في معالج، راجع كيفية القيام بما يلي: قم بإنشاء إضافة-في.

  2. في الصفحة تحديد "اللغة برمجة" ، حدد أما إنشاء إضافة-باستخدام Visual C#‎ تشغيل #Visual Cالمثال التالي، أو إنشاء إضافة-باستخدام Visual أساسى ليعمل في Visual Basicالمثال.

  3. لصق the مثال دالة below إلى the يعيّن فئة في the ‏‫Visual Studio وظيفة إضافية لـ معالج generated تعليمات برمجية.

  4. يتصل the دالة من the OnConnection أسلوب كـ described في كيفية القيام بما يلي: ترجمة و تشغيل أمثلة تعليمات برمجية طراز كائن للتنفيذ التلقائي.

  5. إلى run the إضافة-في, انقر إضافة-في المدير تشغيل the أدوات قائمة, تحديد the إضافة-في you تاريخ الإنشاء, و انقر ‏‏موافق.

    A قائمة of الجميع اختصار مفاتيح حدود إلى the File.NewFile الأمر displays.

مثال

The following مثال illustrates the استخدم of Bindings بواسطة displaying الجميع اختصار مفاتيح حدود إلى the File.NewFile الأمر.

Public Sub OnConnection(ByVal application As Object, ByVal _
  connectMode As ext_ConnectMode, ByVal addInInst As Object, ByRef _
  custom As Array) Implements IDTExtensibility2.OnConnection
    _applicationObject = CType(application, DTE2)
    _addInInstance = CType(addInInst, AddIn)
    ' Pass the applicationObject member variable to the code example.
    ListKeyBindings(_applicationObject)
End Sub

Sub ListKeyBindings(ByVal dte As DTE2)
    ' Bindings() is an array of key binding string names.
    Dim bindings() As Object
    Dim binding As Object
    Dim msg As String = Nothing
    ' Populate the collection with all of the bindings
    ' for the command File.NewFile.
    bindings = dte.Commands.Item("File.NewFile").Bindings
    For Each binding In bindings
        msg += CStr(binding) & vbCr
    Next
    MsgBox(msg)
 End Sub
// Add-in code.
public void OnConnection(object application,
 Extensibility.ext_ConnectMode connectMode, object addInInst, ref
 System.Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;

    //Pass the applicationObject member variable to the code example.
    ListKeyBindings((DTE2)_applicationObject);
}
public void ListKeyBindings(DTE2 dte)
{
    object[] bindings;
    string msg = string.Empty;
    // Populate the collection with all of the bindings associated
    // with the command File.NewFile.
    // Bindings() is an array of key binding string names.
    bindings = (object[])dte.Commands.Item("File.NewFile", 0).Bindings;
    foreach (object b in bindings)
    {
        msg += ((string)b) + "\n";
    }
    System.Windows.Forms.MessageBox.Show(msg);
}

راجع أيضًا:

المهام

كيفية القيام بما يلي: المحافظة على اختصارات لوحة المفاتيح موجود

المبادئ

تنسيق معلمة خاصية الربط

موارد أخرى

ربط إضافة-في الأوامر إلى مفاتيح