在窗体上拖一个ContextMenuStrip控件,然后
private void notifyIcon1_MouseClick(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right) { this.contextMenuStrip1.Show(MousePosition.X, MousePosition.Y - this.contextMenuStrip1.Size.Height); } } private void LookToolStripMenuItem_Click(object sender, EventArgs e) { this.ShowInTaskbar = true; this.Visible = true; this.WindowState = FormWindowState.Normal; this.notifyIcon1.Visible = false; } private void toolStripMenuItem1_Click(object sender, EventArgs e) { Application.Exit(); }
给最小化托盘增加右键菜单
时间: 2024-11-02 00:55:22