ToolStrip Class
Assembly: System.Windows.Forms (in system.windows.forms.dll)
'Declaration <ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _ <ComVisibleAttribute(True)> _ Public Class ToolStrip Inherits ScrollableControl Implements IComponent, IDisposable 'Usage Dim instance As ToolStrip
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ /** @attribute ComVisibleAttribute(true) */ public class ToolStrip extends ScrollableControl implements IComponent, IDisposable
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) ComVisibleAttribute(true) public class ToolStrip extends ScrollableControl implements IComponent, IDisposable
Use ToolStrip and its associated classes in new Windows Forms applications to create toolbars that can have a Windows XP, Office, Internet Explorer, or custom appearance and behavior, all with or without themes, and with support for overflow and run-time item reordering. ToolStrip controls also offer a rich design-time experience that includes in-place activation and editing, custom layout, and sharing of horizontal or vertical space within a specified ToolStripContainer.
ToolStrip is the container for ToolStripButton, ToolStripComboBox, ToolStripSplitButton, ToolStripLabel, ToolStripSeparator, ToolStripDropDownButton, ToolStripProgressBar, and ToolStripTextBox objects.
While the ToolStrip class provides many members that manage painting, mouse and keyboard input, and drag-and-drop functionality, you can use the ToolStripManager class to join ToolStrip controls within a specified ToolStripContainer and merge ToolStrip controls with each other. Use the ToolStripRenderer class with the ToolStripManager class to gain even more control and customizability over painting and layout style.
Use the ToolStripControlHost class to host any other Windows Forms control in a ToolStrip.
Although ToolStrip replaces and adds functionality to the ToolBar control of previous versions, ToolBar is retained for both backward compatibility and future use if you choose.
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.ToolStrip
System.Windows.Forms.BindingNavigator
System.Windows.Forms.MenuStrip
System.Windows.Forms.StatusStrip
System.Windows.Forms.ToolStripDropDown
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.