private int count = 0;
              private void menuItem3_Click(object sender, System.EventArgs e)
              {
                     Form form = new Form();
                     form.Text = (this.count++).ToString();
                     form.MdiParent = this;
                     form.Closed += new EventHandler(form_Closed);
                     form.Show();
              }
 
              private void Form1_MdiChildActivate(object sender, System.EventArgs e)
              {
                     this.menuItem1.MenuItems.Clear();
                     foreach(Form form in this.MdiChildren)
                     {
                            this.menuItem1.MenuItems.Add(form.Text);
                     }
              }
 
MdiChildren有个BUG,但有窗体关闭后,它的值总还比实际还在打开的窗体个数多一个。最近关闭的窗体没有从MdiChildren中移除,在Form的Closed事件后也没移除,我要在什么时候才能得到实际剩余窗体呀????

相关文章:

  • 2021-07-24
  • 2022-03-03
  • 2022-02-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
猜你喜欢
  • 2021-09-06
  • 2021-09-10
  • 2021-05-18
  • 2022-03-01
  • 2021-10-16
  • 2021-06-04
  • 2022-01-20
相关资源
相似解决方案