Hello!
Using Whidbey Beta 2 I built a simple MDI App with Menu- and ToolStrip-Controls on the Parent and on the Child. If the Child Form is shown, the MenuItems and the Tool-Items itself are correctly merged with the main Tool-/MenuStrips placed on the MDI Parent.
But on the MDI Child an empty MenuStrip and an empty ToolStrip are still present. I found no documentation to make the Strip-Containers disapear if the Items of the Strips are merged with a "parent Strip".
It doesn't matter whether the Strips are placed directly on the Form or wrapped by an ToolStripContainer.
Is this a BUG or has anyone an idea or workaround
Thx for any suggestions!

MDI Merging /w ToolStrip and ToolStripContainer
cost7615
Is there one for a MenuStrip
Janmre
Stefan
Hoang Nguyen
However, it still seems to me that if I set AllowMerge to true on the both the parent and child forms, it should merge and unmerge the toolstrip automatically as I toggle between MDI forms (as it did in the Whidbey version). That's the behavior I would expect. Is this a bug in the new version, or was it a bug in the Whidbey version I personally like the way it worked in Whidbey better.
Feng Chun
ToolStripManager
.Merge(..., ...);GoldnGreen
Thanks, that really helped. What I now have is:
An interface
private void MDIParent1_MdiChildActivate(object sender, EventArgs e)
{
//...//Merge ToolStripManager.RevertMerge(toolStrip); ToolStripManager.RevertMerge(menuStrip); if (this.ActiveMdiChild != null)
{
if ((ActiveMdiChild as ICipherInputForm).CipherToolStrip != null) ToolStripManager.Merge((ActiveMdiChild as ICipherInputForm).CipherToolStrip, toolStrip); if ((ActiveMdiChild as ICipherInputForm).CipherMenuStrip != null) ToolStripManager.Merge((ActiveMdiChild as ICipherInputForm).CipherMenuStrip, menuStrip);}
public interface ICipherInputForm
{
//...System.Windows.Forms.
ToolStrip CipherToolStrip{
get;}
System.Windows.Forms.
MenuStrip CipherMenuStrip{
get;}
}
And in each mdiChild I have
public ToolStrip CipherToolStrip
{
get{
return toolStrip1;}
}
/// <summary> /// The toolStrip that this cipher uses to display UI /// </summary> public MenuStrip CipherMenuStrip{
get{
return menuStrip1;}
}
Pitty they didn't just leave automerging in. Oh well.
warp9.5
Thanks in advance.
cs96ai
MenuStrips/ToolStrips in the MDIChildren should be set to visible=false. Hope that helps.
Vernon in Middlewich
Hi, Julie
I have the same problem... trying to solve, then reply to you:)
Randy Cragin
I've updated my application (works for Tool & Menu strips - see Remarks in http://msdn2.microsoft.com/library/5523fet0)
You also need to unset (revert) the merge when MDI child forms close. You can get the main menu from an MDI child if you set its MainMenuStrip property E.g.
MainMenuStrip = myMenuStrip;
private void FormMainMDI_MdiChildActivate(object sender, EventArgs e)I cannot find a toolstrip equivalent, so I put a public "get" property in the MDI child form to get the toolstrip.
I've ended up with the following MDI parent child activate event like this
{
SetFormText();
// unmerge the toolbar and menu from the child as an existing one has gone ToolStripManager.RevertMerge(TS1); ToolStripManager.RevertMerge(MB1); if (this.ActiveMdiChild != null){
// set the icon to match the child this.Icon = this.ActiveMdiChild.Icon; ToolStripManager.Merge(((YourChildForm)this.ActiveMdiChild).ToolStrip, TS1); ToolStripManager.Merge(ActiveMdiChild.MainMenuStrip, MB1);}
else{
// set the default icon this.Icon = CustomControls.Helpers.GetIcon("YourDefault.ico");}
// need to get my recent files when unmerging - it loses all knowledge of them as the menu item is dynamically created_recentFiles =
new RecentFiles();}
Hope this helps