码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2014-08-14 13:13:48      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   os   io   for   ar   div   

在窗体上拖一个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();
        }

 

给最小化托盘增加右键菜单,布布扣,bubuko.com

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

标签:style   blog   color   os   io   for   ar   div   

原文地址:http://www.cnblogs.com/wpcnblog/p/3911989.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!