怎么样在点了窗体的关闭按钮后,是程序缩小到系统托盘显示~~
要用系统API吗?
求高人指点,小弟先谢过~~

解决方案 »

  1.   

    不要,参看
    http://www.syncfusion.com/faq/windowsforms/search/568.aspx你需要在Form_Closing事件中做处理
      

  2.   

    在Form_Closing方法中
    e.Cancel = true;
      

  3.   

    在窗口上放一个NotifyIcon控件。
      

  4.   

    http://blog.csdn.net/serversql/archive/2006/03/20/629983.aspx
      

  5.   

    关闭的时候,hide()
    showintaskbar = false;
    添加NotifyIcon 控件。
      

  6.   

    添家notifyIcon控件在InitializeComponent()中添加
    this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);添加方法
    private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    {
         //设置notifyIcon1属性,Icon必须有;
    }
      

  7.   

    this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);
    private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    {
                               //ICON属性在属性栏选择
    Form1 form1 = new Form1 ();
    form1.Hide ();
    this.ShowInTaskbar =false;
    }
    以上代码的运行结果是:运行时图标区会有增加一个小图标,但是关闭程序后小图标也会接着消失。
    ------------------------我是新手--------------------
      

  8.   

    protected override void OnClosing(CancelEventArgs e)
            {            this.WindowState = FormWindowState.Minimized;
                e.Cancel = true; 
            }
      

  9.   

    在窗体里放个notifyicon,然后在窗体初始化时间里写,this.hide()就可以了
      

  10.   

    private void Form2_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    {
    this.Hide ();
    this.ShowInTaskbar =false;
    DialogResult dr = MessageBox.Show("fds","fsf",MessageBoxButtons.OKCancel,MessageBoxIcon.Question);
    if(dr==DialogResult.Cancel)
    {
    e.Cancel = true; 
    }
      
    }
      

  11.   

    private void Form2_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    {
    this.Hide ();
    e.Cancel = true; 
      
    }
      

  12.   

    private void main_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    {
    this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
    e.Cancel=true;
    }