我用C#写了一个简单软件,现在我想启动它的时候,让它隐藏到窗口的右下角,点击窗口右下角的图标,在还原到屏幕窗口.

解决方案 »

  1.   

    使用NotifyIcon
    启动时候
    this.WindowState = FormWindowState.Minimized;
    this.ShowInTaskbar = false;双击notifyIcon
    this.WindowState = FormWindowState.Normal;
    this.ShowInTaskbar = true;
      

  2.   

    NotifyIcon 是一个控件,兄弟~
      

  3.   

    private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
            {
                this.Show();
                this.WindowState = FormWindowState.Normal;
            }
            void Form1_SizeChanged(object sender, System.EventArgs e)
            {
                if (this.WindowState == FormWindowState.Minimized)
                    this.Hide();
            }
      

  4.   

    private void notifyIcon1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
    {
    this.WindowState = FormWindowState.Normal;
    this.ShowInTaskbar = true; }
    不知道这段代码放在哪里?
    this.WindowState = FormWindowState.Minimized;
    this.ShowInTaskbar = false;
      

  5.   

    添加一个notifyIcon控件,设置好Icon,默认是没有的,不会显示
    双击,就出来一个事件
    如果想窗口在的时候,状态栏不显示,那就默认visible为false,最小化后,改为true,双击后,又为false
      

  6.   

    设的是WindowState...
    ******
    要给notifyIcon1设置个icon才会显示出来
      

  7.   

    private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
            {
                this.Show();
                this.WindowState = FormWindowState.Normal;
                this.notifyIcon1.Visible = false;
            }
            void Form1_SizeChanged(object sender, System.EventArgs e)//添加一个事件
            {
                if (this.WindowState == FormWindowState.Minimized)
                {
                    this.notifyIcon1.Visible = true;
                    this.Hide();
                }
            }