We recommend using Visual Studio 2017

Changing Window Characteristics

Windows in Visual Studio .NET are represented in the automation model by the Window object. Using its members, you can manipulate the characteristics of a window, such as its width, height, visibility, and so forth. Using the Windows and LinkedWindows collections allows you to create a linked window — that is, two or more tool windows docked together. Their members also allow you to dock or undock additional windows to/from the frame.

The Windows collection also allows you to create your own tool windows. For more information about this, see Creating and Controlling Tool Windows.

Linked Window Frame Example

The following VSA example demonstrates how to reference and use the various members of the automation model to manipulate tool windows. The example below creates a linked tool window and inserts two Visual Studio .NET tool windows, namely the Solution Explorer and Output windows, linking them together. It also shows how to size and undock tool windows.

Sub LinkedWindowFrameExample()
   Dim Frame As Window
   Dim w1 As Window = DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer)
   Dim w2 As Window = DTE.Windows.Item(Constants.vsWindowKindOutput)
   Dim w3 As Window = DTE.Windows.Item(Constants.vsWindowKindCommandWindow)

   'Create a linked window frame and dock togther the Solution Explorer 
   'and Ouput windows together inside it.
   Frame = DTE.Windows.CreateLinkedWindowFrame(w1, w2, vsLinkedWindowType.vsLinkedWindowTypeDocked)
   MsgBox("Total number of windows in the linked window frame: " & Frame.LinkedWindows.Count)

   'Add an additional tool window, the Command window, to the frame with 
   'the other two.
   MsgBox("Total number of windows in the linked window frame: " & Frame.LinkedWindows.Count)

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

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

   'Undock the Command window from the frame.
End Sub

See Also

Creating and Controlling Environment Windows | Creating and Controlling Tool Windows | Creating Add-Ins and Wizards | Creating an Add-In | Creating a Wizard | Automation and Extensibility Reference | Automation Object Model Chart