views:

25

answers:

1

In .net MDI application the menu of child form automatically is merged to the menu of parent form. Is there a way to do similar thing with the tool bars.The concept is to send the toolbar of active child to the parent toolbar stripe.

I found http://community.devexpress.com/forums/p/5696/24663.aspx but could not achied it.

+1  A: 

It can be done if following way . More detail could be found in this blog. Both forms should have a toolstrip.

       //In Parent form
        protected override void OnMdiChildActivate(EventArgs e)
        {
            base.OnMdiChildActivate(e); //REQUIRED
            HandleChildMerge(); //Handle merging
        }


        private void HandleChildMerge()
        {
            ToolStripManager.RevertMerge(tsParent);
            IChildForm ChildForm = ActiveMdiChild as IChildForm;
            if (ChildForm != null)
            {
                ToolStripManager.Merge(ChildForm.ChildToolStrip, tsParent);
            }
        }

   public partial class frmChild : Form, IChildForm
   {...}
   interface IChildForm
    {
        ToolStrip ChildToolStrip { get; set; }
    }
Thunder