Question

I've got a .NET MDI (multiple document interface) application that I want to use draggable ToolStrip controls. I want the ToolStrip controls to be at the top of my MDI form (just under the menus). When I use the standard ToolStripContainer inside the MDI form I can't show just the top docking strip, it always shows the center content panel and that hides and child forms in my MDI application. I tried setting the ToolStripContainer docking to "top" (instead of "fill") but the content panel is still shown and it doesn't resize correctly when I have multiple lines of ToolStrip controls.

Is there a way to hide the content panel of the ToolStripContainer so it plays nice in an MDI form? If not, how do I get draggable ToolStrip controls in an MDI form? It would seem like draggable ToolStrips in MDI applications would be a common request.

Was it helpful?

Solution

I found the solution! There is a control that is not listed in the Toolbox by default that does exactly what I want. It is the System.Windows.Forms.ToolStripPanel control.

  1. In the Toolbox window, right click and select "Choose Items..."
  2. A "Choose Toolbox Items" window will appear. Scroll down to the ToolStripPanel control and check the box. Click "OK"
  3. Now drag a ToolStripPanel onto your MDI form and set the Docking to "top".
  4. You can now put ToolStrip controls inside the panel and they will be draggable, the panel will resize (to multiple rows) correctly, and your MDI children are still visible!
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top