开发者

Merging MDI toolbar

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 i开发者_C百科s 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 achieve it.


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; }
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜