码迷,mamicode.com
首页 > Windows程序 > 详细

隐藏到托盘(C#)

时间:2015-12-03 14:09:36      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:

        private void Form1_Resize(object sender, EventArgs e)
        {
            if (this.WindowState == FormWindowState.Minimized)//最小化到系统托盘
            {
                notifyIcon1.Visible = true;//显示托盘图标
                this.Hide();//隐藏窗口
            }
        }

        private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                this.Show();
                WindowState = FormWindowState.Normal;
                this.Focus();
            }
        }

        private void label_min_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }

        private void label_close_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;//使关闭时窗口向右下角缩小的效果
        }

 

隐藏到托盘(C#)

标签:

原文地址:http://www.cnblogs.com/margin-gu/p/5015779.html

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