MdiContainer

 1         /// <summary>
 2         /// 显示form
 3         /// </summary>
 4         /// <param name="form">要显示的form</param>
 5         /// <param name="canClose">是否将其他form关闭</param>
 6         private void ShowForm(Form form, bool canClose)
 7         {
 8             foreach (Form mdiChild in MdiChildren)
 9             {
10                 bool b = mdiChild.GetType() == form.GetType();
11                 if (b)
12                 {
13                     form.Close();
14                     mdiChild.Focus();
15                     return;
16                 }
17                 if (canClose)
18                 {
19                     mdiChild.Close();
20                 }
21             }
22             form.MdiParent = this;
23             form.ControlBox = false;
24             form.WindowState = FormWindowState.Maximized;
25             form.Show();
26         }

 

posted on 2017-07-22 07:51  jonney_wang  阅读(250)  评论(0编辑  收藏  举报

导航