ToolStripContainer Class
Assembly: System.Windows.Forms (in system.windows.forms.dll)
'Declaration <ComVisibleAttribute(True)> _ <ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _ Public Class ToolStripContainer Inherits ContainerControl 'Usage Dim instance As ToolStripContainer
/** @attribute ComVisibleAttribute(true) */ /** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ public class ToolStripContainer extends ContainerControl
ComVisibleAttribute(true) ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) public class ToolStripContainer extends ContainerControl
The ToolStripContainer consists of an expandable and collapsible ToolStripPanel on each side of the control, and a central ToolStripContentPanel. Use a ToolStripPanel to hold one or more ToolStrip, MenuStrip, or StatusStrip controls. Use the central ToolStripContentPanel to hold other controls.
You can hide each of the top, bottom, left, and right panels by setting their respective TopToolStripPanelVisible, BottomToolStripPanelVisible, LeftToolStripPanelVisible, and RightToolStripPanelVisible properties to false. By default, each of these properties is true at design time. Also at design time, the ToolStripContainer appears with its top panel already expanded.
The following code example demonstrates adding a ToolStripContainer and a ToolStrip to a Windows Forms, adding items to the ToolStrip, and adding the ToolStrip to the TopToolStripPanel of the ToolStripContainer.
Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.Data Imports System.Drawing Imports System.Text Imports System.Windows.Forms Public Class Form1 Inherits Form Private toolStripContainer1 As ToolStripContainer Private toolStrip1 As ToolStrip Public Sub New() InitializeComponent() End Sub 'New <STAThread()> _ Shared Sub Main() Application.EnableVisualStyles() Application.Run(New Form1()) End Sub 'Main Private Sub InitializeComponent() toolStripContainer1 = New System.Windows.Forms.ToolStripContainer() toolStrip1 = New System.Windows.Forms.ToolStrip() ' Add items to the ToolStrip. toolStrip1.Items.Add("One") toolStrip1.Items.Add("Two") toolStrip1.Items.Add("Three") ' Add the ToolStrip to the top panel of the ToolStripContainer. toolStripContainer1.TopToolStripPanel.Controls.Add(toolStrip1) ' Add the ToolStripContainer to the form. Controls.Add(toolStripContainer1) End Sub 'InitializeComponent End Class 'Form1
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.ScrollableControl
System.Windows.Forms.ContainerControl
System.Windows.Forms.ToolStripContainer
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.