Making Toolstripcontainer Parent Works as MDI Parent

This is for C # and I am working on a Windows 7 environment with Visual Studio Express 2010. I have an application where I have the toolstripcontainer dock set installed so that users can add toolbars at any edge. The problem was that the toolstripcontainer covered what I want to use for storing submarines. The main form containing the toolstripcontainer has been set as the parent of mdi. I found this article helpful for getting sub in a container: How to use ToolStripContainer with Dock = Populate MDI parent?

However, sub-windows designed in this way do not appear to behave as they should in a "native" MDI environment. Borders look as if the 7 Aero window effect was turned off, and minimizing the sub window makes it completely disappear.

Essentially I want an MDI area for the sub windows, surrounded by docking areas of the toolbar.

Many thanks for your help

+3


source to share


1 answer


Unfortunately, the ToolStripContainer is not designed to work with an MDI form.

Try using the ToolStripPanel control. It doesn't work very well in the designer (it probably isn't in the default ToolBox for some reason).



Example:

public partial class Form1 : Form {

  public Form1() {
    InitializeComponent();

    this.IsMdiContainer = true;
    ToolStripPanel leftPanel = new ToolStripPanel() { Dock = DockStyle.Left };
    ToolStripPanel topPanel = new ToolStripPanel() { Dock = DockStyle.Top };
    this.Controls.Add(leftPanel);
    this.Controls.Add(topPanel);

    ToolStrip ts = new ToolStrip() { Dock = DockStyle.Fill };
    ToolStripButton tsb = new ToolStripButton("Test", SystemIcons.Application.ToBitmap());
    ts.Items.Add(tsb);

    topPanel.Controls.Add(ts);
  }
}

      

+3


source







All Articles