public PipelineDiagramUI() { InitializeComponent(); AllowSelection = false; this.Controls.Add(pipelineSmiley); pipelineSmiley.Anchor = AnchorStyles.Top | AnchorStyles.Right; pipelineSmiley.Left = this.Width - pipelineSmiley.Width; pipelineSmiley.Top = 0; pipelineSmiley.BringToFront(); _deleteSelectedMenuItem = new MenuItem("Delete selected component", DeleteSelectedComponent) { Shortcut = Shortcut.Del, Enabled = false }; ContextMenu = new ContextMenu(new [] { _deleteSelectedMenuItem }); }
public PipelineDiagramUI() { InitializeComponent(); AllowSelection = false; this.Controls.Add(pipelineSmiley); pipelineSmiley.Anchor = AnchorStyles.Top | AnchorStyles.Right; pipelineSmiley.Left = this.Width - pipelineSmiley.Width - 1; pipelineSmiley.Top = 1; pipelineSmiley.BringToFront(); _deleteSelectedMenuItem = new ToolStripMenuItem("Delete selected component", null, DeleteSelectedComponent) { ShortcutKeys = Keys.Delete, Enabled = false }; var cms = new ContextMenuStrip(); cms.Items.Add(_deleteSelectedMenuItem); ContextMenuStrip = cms; }