在线等怎样让窗体最小化时不在任务栏显示而是在像QQ那样在右下脚显示?

解决方案 »

  1.   

    很简单,给你写个例子:        private void Form1_Load(object sender, EventArgs e)
            {
                this.components = new Container();
                notiIcon = new NotifyIcon(this.components);
                notiIcon.Icon = new Icon("images\\sample.ico");
                notiIcon.Text = "这是俺的一个例子程序! 2006.9";
                notiIcon.MouseClick += new MouseEventHandler(n_MouseClick);
                notiIcon.Visible = true;
            }        void n_MouseClick(object sender, MouseEventArgs e)
            {
                if (this.WindowState == FormWindowState.Minimized)
                    this.WindowState = FormWindowState.Normal;
            }
      

  2.   

    images\\sample.ico 是你放在项目里的一个图标文件,注意要设置其属性为“始终复制到输出目录”才能顺利调试。
      

  3.   

    再加上让窗口在缩小时不显示在任务栏的功能:        private void Form1_SizeChanged(object sender, EventArgs e)
            {
                this.ShowInTaskbar = (this.WindowState != FormWindowState.Minimized);
            }