合并MDI工具栏

发布于 2024-09-11 21:38:50 字数 254 浏览 1 评论 0原文

在.net MDI应用程序中,子窗体的菜单自动合并到父窗体的菜单中。 有没有办法对工具栏做类似的事情。这个概念是将活动子工具栏发送到父工具栏条带。

我发现 http://community.devexpress.com/forums/p/5696/ 24663.aspx 但无法实现。

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 achieve it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别把无礼当个性 2024-09-18 21:38:50

如果按照以下方式就可以完成。
更多详细信息,请参阅此博客 。两种形式都应该有一个工具条。

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

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; }
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文