我遇到的问题如下图:
MDI主窗体:MDI子窗体:效果图:
看了图,我想大家能明白我的意思。就是为什么最后的MDI菜单条上会出现两组最小化,还原,关闭的按钮呢?
下面贴上我的代码:
MDI主窗体的代码,很简单,我想不用解释什么了,大家都是好手。using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Linus.Fin.PlugInModel;namespace Linus.Fin.MainFrame
{
    public partial class MainForm : Form
    {
        private AppBridge m_oAppBridge = null;
        private ChildForm m_frmChildForm = null;
        public MainForm()
        {
            InitializeComponent();            m_oAppBridge = new AppBridge(this);
            m_frmChildForm = new ChildForm(m_oAppBridge.MainInterface);
            m_frmChildForm.MdiParent = this;
            m_frmChildForm.ControlBox = false;
            m_frmChildForm.Show();
                        
        }        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //增加一个新的子窗体
            ChildForm frm = new ChildForm(m_oAppBridge.MainInterface);
            frm.MdiParent = this;
            frm.ControlBox = true;
            frm.Text = "Child-" + this.MdiChildren.Length.ToString();
            frm.Show();        }
    }
}下面是子窗体的代码:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Linus.Fin.PlugInModel;namespace Linus.Fin.MainFrame
{
    public partial class ChildForm : Form
    {        
        private SysFuncList m_ctlFuncList = null;
        private MainInterface m_oInterface = null;
        public ChildForm(MainInterface oInterface)
        {
            InitializeComponent();
            m_oInterface = oInterface;
            //窗体控件,把控件添加到子窗体上,然后这个子窗体将会在主窗体里显示
            m_ctlFuncList = new SysFuncList(m_oInterface);
            m_ctlFuncList.Dock = DockStyle.Fill;
            this.Controls.Add(m_ctlFuncList);
                                   //this.Parent = oInterface.MdiParent;
        }
    }
}这就是我两个窗体的构造函数,其中MainInterface是项目的插件模型对象,在此可以忽略它的影响。我就是想知道为什么变成上面图示的那样两组按钮,郁闷死我了。
请大家赐予援手。

解决方案 »

  1.   

    http://1813.img.pp.sohu.com.cn/images/2008/9/20/20/27/11d26d5f5f8g215.jpg
    http://1853.img.pp.sohu.com.cn/images/2008/9/20/20/26/11d26d5d985g215.jpg
    http://1803.img.pp.sohu.com.cn/images/2008/9/20/20/27/11d26d2ae59g213.jpg麻烦达人们再IE里打开一下~~~~
      

  2.   

    专家们出来啊,虽然这个不是什么难题,但是也应该算是个怪题了~~~以前都是看别人问什么刷新防闪烁的,网上搜索了好久也没找到谁遇到跟我这样一样的问题的。顺便说一下,我的VS版本是2008的。再公司VS2005上也是这样的问题。
      

  3.   

    经过摸索原来是因为再设计器里把子窗体设置成最大化的问题。这是VS2005和VS2008都存在的问题。为了避免这个现象,只需要在运行期设置这个属性就好了。
    ChildForm frm = new ChildForm(m_oAppBridge.MainInterface);
                frm.MdiParent = this;
                frm.ShowIcon = false;
                //frm.ControlBox = true;
                frm.WindowState = FormWindowState.Maximized;
                frm.Text = "Child-" + this.MdiChildren.Length.ToString();
                frm.Show();