标题:合并子窗体上的菜单和工具栏的简单方法
取消只看楼主
heyu52
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2008-4-11
 问题点数:0 回复次数:0 
合并子窗体上的菜单和工具栏的简单方法
假设主窗体上有工具栏toolStrip1,和菜单栏存在
private void Form1_MdiChildActivate(object sender, EventArgs e)
        {
            ToolStripManager.RevertMerge(toolStrip1);
            if (this.ActiveMdiChild == null) return;

            foreach (Control control in this.ActiveMdiChild.Controls)
            {
                if (control is ToolStrip)
                {
                    ToolStripManager.Merge((ToolStrip)control, toolStrip1);
                    control.Visible = false;
                }
                else if(control is MenuStrip )
                {
                    control.Visible = false;
                }
            }
            if (toolStrip1.Items.Count > 0)
            { toolStrip1.Visible = true; }
            else
            { toolStrip1.Visible = false; }
        }
搜索更多相关主题的帖子: 窗体 菜单 工具 
2008-05-29 23:14



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-216588-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.133312 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved