using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace IOB_WIN { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } protected void closeActiveChild() { if (this.HasChildren) { try { this.ActiveMdiChild.Close(); this.LayoutMdi(MdiLayout.TileHorizontal); } catch { } } } protected void openChild() { TestForm child = new TestForm(); child.MdiParent = this; child.Show(); this.LayoutMdi(MdiLayout.TileHorizontal); } private void closeChildToolStripMenuItem_Click(object sender, EventArgs e) { closeActiveChild(); } private void openChildToolStripMenuItem_Click(object sender, EventArgs e) { openChild(); } } }