托盘程序代码段 C# .net

 #region Show/Hide
  private void menuShowHideCrabo_Click(object sender, System.EventArgs e)
  {
   if(this.Visible)
   {
    this.Hide();
    this.ShowInTaskbar=false;
   }
   else
   {
    this.ShowInTaskbar=true;
    this.Show();
    this.WindowState=FormWindowState.Normal;
    this.Activate();
   }
  }

  private void menuQuitCrabo_Click(object sender, System.EventArgs e)
  {
   Application.Exit();
  }

  private void notifyIconCrabo_DoubleClick(object sender, System.EventArgs e)
  {
   if(this.Visible)
   {
    this.Hide();
    this.ShowInTaskbar=false;
   }
   else
   {
    this.ShowInTaskbar=true;
    this.Show();
    this.WindowState=FormWindowState.Normal;
    this.Activate();
   }
  }

  private void PollFormCrabo_SizeChanged(object sender, System.EventArgs e)
  {
   if (this.WindowState == FormWindowState.Minimized)
   {
    this.Hide();
    this.ShowInTaskbar=false;
   }
  }
  #endregion

你可能感兴趣的:(.net,object,C#)