给最小化托盘增加右键菜单

在窗体上拖一个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();
        }
原文地址:https://www.cnblogs.com/wpcnblog/p/3911989.html