OK, I simply cant make it work that way.
1. For ending the initialization of the dockmanager the form must be toplevel
2. For assigning the form to the contentpanel it cannot be toplevel
Also making it an mdi container seems to be impossible with similar conflicts
How do I move on. ?? See ex. below
private void ConnectToolStripContainerAndDock()
{
this.components = new Container();
this.dockManager = new DockManager(this.components);
this.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dockManager)).BeginInit();
this.IsMdiContainer = true;
this.dockManager.DefaultMdiWindowState = System.Windows.Forms.FormWindowState.Maximized;
this.dockManager.DocumentMdiStyle = ActiproSoftware.UIStudio.Dock.DocumentMdiStyle.Standard;
this.dockManager.NextWindowNavigationEnabled = true;
// Add menu with two entries.
// one to create a new form and another to toggle mdi-mode
toolStripContainer = new ToolStripContainer();
toolStripContainer.Dock = DockStyle.Fill;
toolStripContainer.TopToolStripPanel.Join(ms);
// Form used as parent for UIstudio dock area
Form formContainer = new Form();
formContainer.TopLevel = false;
formContainer.Dock = DockStyle.Fill;
//formContainer.IsMdiContainer = true;
toolStripContainer.ContentPanel.Controls.Add(formContainer);
this.dockManager.HostContainerControl = formContainer;
this.Controls.Add(toolStripContainer);
((System.ComponentModel.ISupportInitialize)(this.dockManager)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
private void newToolStripMenuItem_Click(object sender, EventArgs e)
{
Form f = new Form();
f.Name = "ChildForm";
f.MdiParent = this;
f.Visible = true;
f.TopLevel = false;
f.FormBorderStyle = FormBorderStyle.None;
f.Dock = DockStyle.Fill;
string key = "1";
string text = f.Name;
DocumentWindow documentWindow = new DocumentWindow(dockManager, key, text + key, 0, f);
documentWindow.Activate();
}
private void toggleMDIModeToolStripMenuItem_Click(object sender, EventArgs e)
{
if (dockManager.DocumentMdiStyle == DocumentMdiStyle.Tabbed)
dockManager.DocumentMdiStyle = DocumentMdiStyle.Standard;
else
dockManager.DocumentMdiStyle = DocumentMdiStyle.Tabbed;
}
NB!
It's a little confusing if you read the documentation. In the chapter "Using the DockManager with ToolStripContainers" you recommend to use a simple usercontrol and then several places you write that mdi modes can be changed runtime. !!