/// <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 button5_Click_1(object sender, EventArgs e) { this.initButton(); this.button5.BackColor = Color.FromArgb(95, 129, 174); TeachersList cform = new TeachersList();//实例化一个子窗口 //设置子窗口不显示为顶级窗口 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.button5.BackColor = Color.FromArgb(95, 129, 174); // Monitor.Enter(this.lockObj); // if (!formSwitchFlag) // { // formSwitchFlag = true; // this.ShowForm(pnlCenter, form1); // formSwitchFlag = false; // } // else // { // return; // } // } //#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 // catch (System.Exception ex) //#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 // { // // // } // finally // { // Monitor.Exit(this.lockObj); // } }