private void добавлениеХолодильникаToolStripMenuItem_Click(object sender, EventArgs e) { int add = 0; for (int i = 0; i < MdiChildren.Length; i++) { if (MdiChildren[i] is FridgeEdit) { add++; } } if (add > 0) { return; } FridgeEdit f = new FridgeEdit(); f.MdiParent = this; f.Show(); relocateWindows(); }
public void relocateWindows() { FridgeEdit edit = null; FridgeFind find = null; foreach (Form f in MdiChildren) { if (f is FridgeFind) { find = (FridgeFind)f; } if (f is FridgeEdit) { edit = (FridgeEdit)f; } } if (edit == null && find == null) { return; } else if (edit != null && find == null) { edit.Location = new Point(0, 0); } else if (edit == null && find != null) { find.Location = new Point(0, 0); } else { edit.Location = new Point(0, 0); find.Location = new Point(edit.Width, 0); find.Width = Width - edit.Width - 20; find.Height = Height - 67; } }