public void OpenChildForm(Form childForm) { if (activeForm != null) { activeForm.Close(); } activeForm = childForm; childForm.TopLevel = false; childForm.FormBorderStyle = FormBorderStyle.None; childForm.WindowState = FormWindowState.Maximized; childForm.Dock = DockStyle.Fill; MainPanel.Controls.Add(childForm); MainPanel.Tag = childForm; childForm.Show(); NuevoBtn.BringToFront(); BackBtn.BringToFront(); }
private void MaxBtn_Click(object sender, EventArgs e) { if (WindowState == FormWindowState.Normal) { WindowState = FormWindowState.Maximized; if (activeForm != null) { activeForm.WindowState = FormWindowState.Normal; } NuevoBtn.BringToFront(); BackBtn.BringToFront(); } else if (WindowState == FormWindowState.Maximized) { WindowState = FormWindowState.Normal; if (activeForm != null) { activeForm.WindowState = FormWindowState.Normal; } NuevoBtn.BringToFront(); BackBtn.BringToFront(); } }