/// <summary> /// 构造方法 /// </summary> public MainForm() { InitializeComponent(); //主窗体容器打开 this.IsMdiContainer = true; this.TitleText = "管理员"; //实例化子窗体界面 form1 = TeachersList.GetIntance; form2 = StudentList.GetIntance; form3 = AddTeacherInformation.GetIntance; form4 = AddStudentInformation.GetIntance; form5 = HomePage.GetIntance; form6 = Notice.GetIntance; form7 = CheckNotification.GetIntance; form9 = ViewResults.GetIntance; form8 = Setting.GetIntance; form10 = PersonalCenter.GetIntance; form11 = Matching.GetIntance; form12 = MatchingFailure.GetIntance; //初始化按钮 this.initButton(); }
private void button2_Click_2(object sender, EventArgs e) { this.initButton(); this.button2.BackColor = Color.FromArgb(95, 129, 174); MatchingFailure cform = new MatchingFailure();//实例化一个子窗口 //设置子窗口不显示为顶级窗口 cform.TopLevel = false; //设置子窗口的样式,没有上面的标题栏 cform.FormBorderStyle = FormBorderStyle.None; //填充 cform.Dock = DockStyle.Fill; //清空控件 this.pnlCenter.Controls.Clear(); //加入控件 this.pnlCenter.Controls.Add(cform); //让窗体显示 cform.Show(); // try // { // this.initButton(); // this.button2.BackColor = Color.FromArgb(95, 129, 174); // Monitor.Enter(this.lockObj); // if (!formSwitchFlag) // { // formSwitchFlag = true; // this.ShowForm(pnlCenter, form12); // formSwitchFlag = false; // } // else // { // return; // } // } //#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 // catch (System.Exception ex) //#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 // { // // // } // finally // { // Monitor.Exit(this.lockObj); // } }