private void ShowContextMenu(int x, int y, GUIControl control) { if (_gui is NormalGUI) { ContextMenuStrip menu = new ContextMenuStrip(); if (control != null) { menu.Items.Add(new ToolStripMenuItem("Bring to Front", null, new EventHandler(BringToFrontClick), "BringToFront")); menu.Items.Add(new ToolStripMenuItem("Send to Back", null, new EventHandler(SendToBackClick), "SendToBack")); if (_selected.Count > 1) { if (!AllSelectedInSameGroup() || control.MemberOf == null) { menu.Items.Add(new ToolStripMenuItem("Group", null, new EventHandler(Group), "LockControl")); } if (control.MemberOf != null) { menu.Items.Add(new ToolStripMenuItem("Ungroup", null, new EventHandler(Ungroup), "LockControl")); } menu.Items.Add(new ToolStripMenuItem("Lock All", null, new EventHandler(LockControl), "LockControl")); menu.Items.Add(new ToolStripMenuItem("Unlock All", null, new EventHandler(UnlockControl), "LockControl")); menu.Items.Add(new ToolStripMenuItem("Distribute Vertically", null, new EventHandler(DistributeVertiClick), "DistVert")); menu.Items.Add(new ToolStripMenuItem("Distribute Horizontally", null, new EventHandler(DistributeHorizClick), "DistVert")); menu.Items.Add(new ToolStripMenuItem("Align Left", null, new EventHandler(AlignLeftClick), "DistVert")); menu.Items.Add(new ToolStripMenuItem("Align Top", null, new EventHandler(AlignTopClick), "DistVert")); } else { if (control.Locked) { menu.Items.Add(new ToolStripMenuItem("Unlock", null, new EventHandler(UnlockControl), "LockControl")); } else { menu.Items.Add(new ToolStripMenuItem("Lock", null, new EventHandler(LockControl), "LockControl")); } } menu.Items.Add(new ToolStripSeparator()); menu.Items.Add(new ToolStripMenuItem("Copy", null, new EventHandler(CopyControlClick), Keys.Control & Keys.C)); menu.Items.Add(new ToolStripMenuItem("Delete", null, new EventHandler(DeleteControlClick), Keys.Delete)); } if (GUIControl.AvailableOnClipboard()) { menu.Items.Add(new ToolStripMenuItem("Paste", null, new EventHandler(PasteControlClick), Keys.Control & Keys.V)); } if (menu.Items.Count > 0) { menu.Show(bgPanel, x, y); } } }