How to show MDI Child Form in a SplitContainer Panel?

P

planaria

I have the sample MDI application from Chris Sells' Book "Windows Forms
2.0 Programming" (www.sellsbrothers.com/writing/wfbook for the sample code).

I have added a SplitContainer to the MDIParentForm. I would now like to
have the MDIChildForms all be shown in the SplitContainer's Panel2
region only (and to still be manageable by the MDI "Window" menu).

How can I do this?

I've tried things like this:
private void onFileNew(object sender, EventArgs e)
{
// Create and show MDI Child Form with nice title
1 MDIChildForm mdiChildForm = new MDIChildForm();
2 mdiChildForm.MdiParent = this;
3 this.m_mainSplitter.Panel2.Controls.Add(mdiChildForm);
4 mdiChildForm.Text = "MDI Child Form " +
(++formCount).ToString();
5 TreeNode childNode = new TreeNode();
6 childNode.Text = "Molecule " + (formCount).ToString();
7 TreeNode parentNode = this.molView1.Nodes[0];
8 parentNode.Nodes.Add(childNode);
9 mdiChildForm.Show();
}

Line 3 is the line I added to make the MDIChild show up in Panel2.
However, they no longer behave like "proper" MDIChildren (eg. the
Windows menu does not work, they can't be tiled, etc.).

Also, note, I've populated the SplitContainer Panel1 with some other
controls (tabbed and treeview). I'm not sure if these extra controls in
Panel1 or some Z-order thing is going on that I don't understand.

Any suggestions would be very helpful.

Thanks in advance!

Cheers,
Mark
 
D

Douglas J Steele

You'll need to ask in a DotNet newsgroup.

All 3 of the groups to which you've posted this are for questions about
forms in Access, the database product that's part of Office Professional.
Access uses VBA, not .Net.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top