مشاركة عبر


كيفية القيام بما يلي: الصفات المميزة لإطار تغيير

الإطارات في Visual Studioتتمثل في طراز أتمتة بواسطة Window2الكائن. باستخدام أعضائها، يمكنك معالجة الصفات المميزة للإطار, مثل بها عرض وارتفاع والرؤية، و ما إلى ذلك. بواسطة استخدام Window2مجموعة، يمكنك إنشاء نافذة مرتبط، والذي يتكون من عمودين أو إرساء نافذةات الأدوات أكثر مع بعضها البعض. بها الأعضاء أيضا تمكنك من إلى مرسى إطارات إضافى إلى أو إلغاء مرسى إطارات إضافى من الإطار.

ملاحظة

الإطارات إلى ربط يجب أن تكون مرئي. إذا كان أي نافذة هو مخفية، يمكنك يحصل استثناء. يمكنك عرض Windows باستخدام Visibleخاصية.

Windows2مجموعة أيضا من إلى إنشاء إطارات إلى ol الخاص بك. لمزيد من المعلومات، راجع كيفية القيام بما يلي: إنشاء و عنصر تحكم أداة Windows.

ملاحظة

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

مثال

تبين الأمثلة التالية كيف يتم الرجوع إلى و استخدام عدة الأعضاء طراز التنفيذ التلقائي للتعامل مع إطارات الأدوات. إنشاء نافذة الأدوات مرتبطة و إدراج الثاني Visual Studioالأداة النافذةات، namely من مستكشف الحل و النافذة إخراج ، ربطها معا. أنها أيضا بإظهار كيفية تحجيم وإلغاء إرساء إطارات الأدوات. قبل تشغيل هذه تعليمات برمجية، تأكد من أن تشير خاصية "يضمّن أنواع Interop" تجميع EnvDTE إلى خطأ. لمزيد من المعلومات حول كيفية تشغيل نموذج التعليمة البرمجية في وظيفة الإضافية، راجع كيفية القيام بما يلي: ترجمة و تشغيل أمثلة تعليمات برمجية طراز كائن للتنفيذ التلقائي.

ملاحظة تنبيهتنبيه

يستخدم هذا المثال سوف تتغير الخاص بك الحالي Visual Studioنافذة أداة التخطيط.

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)
    chgWindow(_applicationObject)
End Sub

Public Sub chgWindow(ByVal dte As DTE2)
    ' Create variables for the various tool windows.
    Dim winFrame As EnvDTE80.Window2
    Dim win1 As Window = _
      dte.Windows.Item(Constants.vsWindowKindSolutionExplorer)
    Dim win2 As Window = dte.Windows. _
    Item(Constants.vsWindowKindOutput)
    Dim win3 As Window = dte.Windows. _
    Item(Constants.vsWindowKindCommandWindow)

    ' Create a linked window frame and dock Solution 
    ' Explorer and the Ouput window together inside it.
    winFrame = CType(dte.Windows.CreateLinkedWindowFrame(win1, win2, _
      vsLinkedWindowType.vsLinkedWindowTypeDocked), Window2)
    MsgBox("Total number of windows in the linked window frame: " & _
    winFrame.LinkedWindows.Count)

    ' Add another tool window, the Command window, to the frame 
    ' with the other two.
    winFrame.LinkedWindows.Add(win3)
    MsgBox("Total number of windows in the linked window frame: " & _
    winFrame.LinkedWindows.Count)

    ' Resize the entire linked window frame.
    winFrame.Width = 500
    winFrame.Height = 600
    MsgBox("Frame height and width changed. Now changing Command _
      window height.")

    ' Resize the height of the Command window.
    winFrame.LinkedWindows.Item(3).Height = 800
    MsgBox("Now undocking the Command window from the frame.")

    ' Undock the Command window from the frame.
    winFrame.LinkedWindows.Remove(win3)
End Sub
public void OnConnection(object application, ext_ConnectMode 
  connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    chgWindow(_applicationObject);
}

public void chgWindow(DTE2 dte)
{
    // Create variables for the various tool windows.
    EnvDTE80.Window2 winFrame;
    Window win1 = 
      dte.Windows.Item(Constants.vsWindowKindSolutionExplorer);
    Window win2 = dte.Windows.Item(Constants.vsWindowKindOutput);
    Window win3 = 
      dte.Windows.Item(Constants.vsWindowKindCommandWindow);

    // Create a linked window frame and dock Solution 
    // Explorer and the Ouput window together inside it.
    winFrame = (Window2)dte.Windows.CreateLinkedWindowFrame(win1, win2, 
      vsLinkedWindowType.vsLinkedWindowTypeDocked);
    System.Windows.Forms.MessageBox.Show("Total number of windows in 
      the linked window frame: " + winFrame.LinkedWindows.Count);

    // Add another tool window, the Command window, to the frame 
    // with the other two.
    winFrame.LinkedWindows.Add(win3);
    System.Windows.Forms.MessageBox.Show(
      "Total number of windows in the linked window frame: " + 
      winFrame.LinkedWindows.Count);

    // Resize the entire linked window frame.
    winFrame.Width = 500;
    winFrame.Height = 600;
    System.Windows.Forms.MessageBox.Show(
      "Frame height and width changed." +
      "Now changing Command window height.");

    // Resize the height of the Command window.
    winFrame.LinkedWindows.Item(3).Height = 800;
    System.Windows.Forms.MessageBox.Show(
      "Now undocking the Command window from the frame.");

    // Undock the Command window from the frame.
    winFrame.LinkedWindows.Remove(win3);
}

راجع أيضًا:

المهام

كيفية القيام بما يلي: إنشاء و عنصر تحكم أداة Windows

كيفية القيام بما يلي: قم بإنشاء إضافة-في

الإرشادات التفصيلية: إنشاء معالج

المبادئ

مخطط نموذج كائن تلقائي

موارد أخرى

إنشاء و التحكم في بيئة Windows

إنشاء إضافة-زر 'Ins' ومعالجات

التنفيذ التلقائي والمرجع الامتداد