vc#做的windows程序,如何让程序在最小化时进入系统托盘?(就是在右下角的栏)

解决方案 »

  1.   

    NotifyIcon查一查MSDN吧,有例程。
      

  2.   

    用NotifyIcon控件,把窗体的ShowInTaskBar设置为false
    就可以了
      

  3.   

    在窗体的Resize事件里
    if (this.WindowState == FormWindowState.Minimized) 
    {
    this.Visible=false;
    }
    else
    {
    this.Visible = true;
    }
    在NotifyIcon的DoubleClick事件里
    if(this.Visible == false) 
    {
    this.Visible = true;
    this.WindowState = FormWindowState.Normal;
    }
    else
    {
    this.WindowState = FormWindowState.Minimized;
    this.Visible = false;
    }
      

  4.   

    http://www.yesky.com/425/213425.shtml一篇用Visual C#做托盘程序的教程
      

  5.   

    主要代码,
    private void ShowHideWindow(bool isShow)
    {
    if(isShow)//显示
    {
    if(this.WindowState == FormWindowState.Minimized)
    {
    this.WindowState = FormWindowState.Normal;
    }
    if(this.ShowInTaskbar==false)
    {
    this.ShowInTaskbar = true;
    this.Show();
    }
    this.Activate();
    }
    else//隐藏
    {
    if(this.WindowState == FormWindowState.Maximized)
    {
    this.WindowState = FormWindowState.Normal;
    }
    if(this.ShowInTaskbar == true)
    {
    this.Hide();
    this.ShowInTaskbar = false;
    }
    }
    }
      

  6.   

    private void Form1_Resize(object sender, System.EventArgs e)
            {
                if (this.WindowState == FormWindowState.Minimized) 
                {
                    this.Visible=false;
                    this.notifyIcon1.Visible = true;
                }
                else
                {
                    this.Visible = true;
                    this.notifyIcon1.Visible = false;                
                }        }        private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)
            {
                if(this.Visible == false) 
                {
                    this.Visible = true;
                    this.WindowState = FormWindowState.Normal;
                    this.notifyIcon1.Visible = false;
                }
                else
                {
                    this.WindowState = FormWindowState.Minimized;
                    this.Visible = false;
                    this.notifyIcon1.Visible = true;
                }        }