HomeSearch

ToolStripContainer Control: Dock, Properties

This article describes the ToolStripContainer control in Windows Forms.
ToolStripContainer adds user interface functionality. It serves as a way to allow ToolStrips (which contain buttons or other controls) to be dragged around the edges of a Form. We specify how ToolStrips can be located and arranged.
Start. To begin, open your Windows Forms project and drag the ToolStripContainer to the Form. Next, you can optionally Dock the ToolStripContainer in the Form. Please see the next section.
When you first add the ToolStripContainer to your project, try clicking on the "Dock Fill in Form" link in Visual Studio 2010. This will expand the ToolStripContainer to reach the four sides of the enclosing form.
Blue arrows. To enable the ToolStripContainer on a certain side, click the blue arrow on that side to expand it. If you add a ToolStrip to that side, try clicking the blue arrow again: the area will expand and more controls can be placed there.
Add ToolStrip. Inside the ToolStripContainer, you can add ToolStrip instances. Make sure you use the blue arrows to expand the side you want to use. Then, drag a ToolStrip to the top, right, left or bottom area you expanded.

And: The ToolStrip will be located in that area by default. A user will be able to drag it to another area.

Properties. With the ToolStripContainer, you can address the top, right, left and bottom panels through your C# code. If you have some ToolStrips located there, you can use these properties to get references to them.

Also: There exist Visibility properties. These properties adjust whether the panel is seen.

Panel types TopToolStripPanel RightToolStripPanel BottomToolStripPanel LeftToolStripPanel
Visibility properties. By assigning a Visibility property to false, you make it so a ToolStrip cannot be dragged to that side. By default, all sides have a Visibility of true. Here are the properties.
PanelVisible properties TopToolStripPanelVisible RightToolStripPanelVisible BottomToolStripPanelVisible LeftToolStripPanelVisible
Summary. With ToolStripContainer, we can arrange ToolStrips in an intuitive and easy-to-manage way. Even though the ToolStripContainer makes it possible to have many ToolStrips, this is likely to frustrate users.

And: Because of this, ToolStripContainers should be used only when it is necessary to have many ToolStrips.

© 2007-2020 Sam Allen. Every person is special and unique. Send bug reports to info@dotnetperls.com.
Home
Dot Net Perls