解决方案 »

  1.   

    打开窗体时创建 有标示的button,关闭窗体时,remove相对应标记的button。
    点击按钮时,同样让窗体显示就可以了
      

  2.   

    class WindowNotifier
    {
        public static readonly WindowNotifier instance = new WindowNotifier();
        public void Open() { OnOpen(this, new EventArgs()); }
        public void Close() { OnClose(this, new EventArgs()); }
        public event EventHandler OnOpen;
        public event EventHandler OnClose;
    }编写一个窗体基类:
    class FormBase
    {
        public FormBase() { 
            this.Load += (a, b) => WindowNotifier.instance.Open();
            this.UnLoad += (a, b) => WindowNotifier.instance.Close();  
        }    
    }其他窗体从它继承
    class Form1 : FormBase
    {
        void Form_Load()
        {
            WindowNotifier.instance.OnOpen += RefreashButtons();
            WindowNotifier.instance.OnClose += RefreashButtons();
        }
        void RefreashButtons(sender, e)
        {
            foreach (var item in this.Controls.OfType<Button>().ToList()) this.Controls.Remove(item);
            foreach (Form item in Application.OpenedForms)
            {
                Button btn = new Button();
                btn.Tag = item;
                btn.Text = item.Text;
                btn.Location = ...
                btn.Size = ...
                btn.Click += (a, b) => ((a as Button).Tag as Form).Close();
                this.Controls.Add(btn);
            }
        }
    }
      

  3.   

    嗯,主要是同时启动多个窗体后,对应动态生成多个button 按钮(一个窗体对应一个button 按钮),点击一个 button 按钮,将该按钮对应的一个窗体显示在最外面,而不是通过点击该窗体,主要是怎样做,我是初学者,没有思路啊。
      

  4.   

    我用过tabcontrol的,不能满足啊,
      

  5.   

    使用MagicDocking效果会更好
      

  6.   

    这个是用toolStrip 做的,你自己修改下,用button,button动态创建在flowLayoutPanel 中就不用手动控制位置了,还有用dev的xtraTabbedMdiManager 这个控件不用写代码就能达到你的要求    private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
            {
                for (int i = 0; i < this.MdiChildren.Length; i++)
                {
                    if (this.MdiChildren[i] == e.ClickedItem.Tag)
                    {
                        this.MdiChildren[i].Activate();
                    }
                }
            }       void BaseForm_ChlidFormClosedEvent(Form form)
            {                for (int i = 0; i < toolStrip1.Items.Count; i++)
                    {
                        if (toolStrip1.Items[i].Tag == form)
                        {
                            if (StrName.Count != 0)
                            {
                                for (int j = 0; j < StrName.Count; j++)
                                {
                                    if (StrName[j] == toolStrip1.Items[i].Tag)
                                        StrName.Remove(StrName[j]);
                                }
                            }
                            this.toolStrip1.Items.Remove(toolStrip1.Items[i]);
                        }
                    }        }
      

  7.   

    不需要生成按钮,在.net应用程序中,每打开一个窗体,.net就会把该窗体存入一个窗体集合(Appliction.OpenForms)中,要想让窗体出现在最顶端,只需调用Appliction.OpenForms[窗体Name].Activate()即可。楼主做的应该是一个窗口管理器,最简单的思路如下:遍历Application.OpenForms,把每个窗体的标题与Name存入listView中,用户选中点激活后,就利用用户选中的项信息调用Activate()即可。不但有激活功能,在MdiParent.Layout()方法中还提供了层叠,水平平铺,垂直平铺等窗体排列功能(只能在MDI中使用)。
      

  8.   


    UIL采购管理.frm_CaiGouGuanLi myfrm_CaiGouGuanLi = new UIL采购管理.frm_CaiGouGuanLi(ref MyPanel);
                panel2.Controls.Clear();
                myfrm_CaiGouGuanLi.TopLevel = false;
                myfrm_CaiGouGuanLi.Parent = panel2;
                myfrm_CaiGouGuanLi.Show();我用panel 作为父容器,
      

  9.   

    UIL采购管理.frm_CaiGouGuanLi myfrm_CaiGouGuanLi = new UIL采购管理.frm_CaiGouGuanLi(ref MyPanel);
                panel2.Controls.Clear();
                myfrm_CaiGouGuanLi.TopLevel = false;
                myfrm_CaiGouGuanLi.Parent = panel2;
                myfrm_CaiGouGuanLi.Show();