http://dotnet.aspx.cc/ShowDetail.aspx?id=AD98CE17-7F43-4C97-8FE5-836B6C743EDA

解决方案 »

  1.   

    回答问题(2)
    工具箱的notifyIcon控件private void Form1_SizeChanged(object sender, System.EventArgs e)
    {
    if(this.WindowState==System.Windows.Forms.FormWindowState.Minimized)
    {
    this.Hide(); //窗体隐藏
    this.notifyIcon1.Visible=true; //窗体显示时,托盘图标可见
    }
    } private void notifyIcon1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
    {
    this.Show();
    this.WindowState=FormWindowState.Normal;
    this.Activate();
    } private void notifyIcon1_Click(object sender, System.EventArgs e)
    {
    this.Visible=true;
    this.WindowState=System.Windows.Forms.FormWindowState.Normal;
    this.notifyIcon1.Visible=false; //窗体显示时,托盘图标不可见
    }