Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ToolStripContainer Class
Collapse the table of content
Expand the table of content

ToolStripContainer Class

Note: This class is new in the .NET Framework version 2.0.

Provides panels on each side of the form and a central panel that can hold one or more controls.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public class ToolStripContainer : ContainerControl
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
public class ToolStripContainer extends ContainerControl
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.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

public class Form1 : Form
    private ToolStripContainer toolStripContainer1;
    private ToolStrip toolStrip1;

    public Form1()
    static void Main()
        Application.Run(new Form1());

    private void InitializeComponent()
        toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
        toolStrip1 = new System.Windows.Forms.ToolStrip();
        // Add items to the ToolStrip.
        // Add the ToolStrip to the top panel of the ToolStripContainer.
        // Add the ToolStripContainer to the form.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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.

.NET Framework

Supported in: 2.0

Community Additions

© 2015 Microsoft