public void ChangeMDIForm(Page page) { if (currentPage == page) { return; } //currentForm.Close(); currentForm.Dispose(); Form newFormPage; switch (page) { case Page.Home: newFormPage = new Staff.StaffHome(); break; case Page.Profile: newFormPage = new Staff.StaffProfile(); break; case Page.PlayerAccount: newFormPage = new Staff.StaffPlayerAccount(); break; case Page.PlayerAccount_inSide: newFormPage = new Staff.StaffPlayerAccount_inSide(); break; case Page.PointCard: newFormPage = new Staff.StaffPointCard(); break; case Page.PointCard_inSide: newFormPage = new Staff.StaffPointCard_inSide(); break; case Page.ReceiveProblems: newFormPage = new Staff.StaffReceiveProblems(); break; case Page.Setting: newFormPage = new Staff.StaffSetting(); break; default: MessageBox.Show("Unexpect switch flow."); return; } newFormPage.MdiParent = this; newFormPage.Dock = DockStyle.Fill; newFormPage.Show(); currentForm = newFormPage; currentPage = page; }
private void StaffMenu_Load(object sender, EventArgs e) { Staff.StaffHome staffHome = new Staff.StaffHome { MdiParent = this, Dock = DockStyle.Fill }; staffHome.Show(); currentForm = staffHome; currentPage = Page.Home; RefreshPage(); }