最小化到托盘

拖一个NotifyIcon

设置form的showInTastbar属性为false

this.SizeChanged += new System.EventHandler(this.Form1_SizeChanged);

private void Form1_SizeChanged(object sender, EventArgs e)
        {
            if (this.WindowState == FormWindowState.Minimized)
            {
                this.Hide();
                this.notifyIcon1.Visible = true;
            }
        }
        private void notifyIcon1_Click(object sender, EventArgs e)
        {
            this.Visible = true;
            this.WindowState = FormWindowState.Normal;
            this.notifyIcon1.Visible = false;
        }

posted @ 2009-08-18 15:58  oraclejava  阅读(128)  评论(0)    收藏  举报