public PageListContextMenuStrip(TabControl tabControl, LabelButton lablBtn) { contextMenuStrip1 = new ClassicContextMenuStrip(); tabControl1 = tabControl; labelButton1 = lablBtn; labelButton1.MouseClick += new System.Windows.Forms.MouseEventHandler(labelButton1_MouseClick); }
private void InitializeComponent() { this.contextMenuStrip1 = new ClassicContextMenuStrip(); this.closeTab = new ToolStripMenuItem(); this.closeAllTab = new ToolStripMenuItem(); this.closeOtherTab = new ToolStripMenuItem(); this.closeLeftTab = new ToolStripMenuItem(); this.closeRightTab = new ToolStripMenuItem(); // // contextMenuStrip1 // this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.closeTab, this.closeAllTab, this.closeOtherTab, this.closeLeftTab, this.closeRightTab}); this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening); // // closeTab // this.closeTab.Name = "closeTab"; this.closeTab.Size = new System.Drawing.Size(140, 22); this.closeTab.Text = "关闭标签(&C)"; this.closeTab.Click += new System.EventHandler(this.closeTab_Click); this.closeTab.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.W))); // // closeAllTab // this.closeAllTab.Name = "closeAllTab"; this.closeAllTab.Size = new System.Drawing.Size(140, 22); this.closeAllTab.Text = "关闭所有(&A)"; this.closeAllTab.Click += new System.EventHandler(this.closeTab_Click); // // closeOtherTab // this.closeOtherTab.Name = "closeOtherTab"; this.closeOtherTab.Size = new System.Drawing.Size(140, 22); this.closeOtherTab.Text = "关闭其他(&B)"; this.closeOtherTab.Click += new System.EventHandler(this.closeTab_Click); // // closeLeftTab // this.closeLeftTab.Name = "closeLeftTab"; this.closeLeftTab.Size = new System.Drawing.Size(140, 22); this.closeLeftTab.Text = "关闭左边(&L)"; this.closeLeftTab.Click += new System.EventHandler(this.closeTab_Click); // // closeRightTab // this.closeRightTab.Name = "closeRightTab"; this.closeRightTab.Size = new System.Drawing.Size(140, 22); this.closeRightTab.Text = "关闭右边(&R)"; this.closeRightTab.Click += new System.EventHandler(this.closeTab_Click); }