Cc code to minimize WinForm program to system tray

From , 4 Years ago, written in C#, viewed 54 times.
URL https://pastebin.vip/view/8ef897e4
  1. // this.SizeChanged += new System.EventHandler(this.Form1_SizeChanged);
  2. //上面一行是主窗体InitializeComponent()方法中需要添加的引用
  3. private void Form1_SizeChanged(object sender, EventArgs e)
  4. {
  5. if (this.WindowState==FormWindowState.Minimized)
  6. {
  7. this.Hide();
  8. this.notifyIcon1.Visible=true;
  9. }
  10. }
  11. .添加点击图标事件(首先需要添加事件引用)
  12. private void notifyIcon1_Click(object sender, EventArgs e)
  13. {
  14. this.Visible = true;
  15. this.WindowState = FormWindowState.Normal;
  16. this.notifyIcon1.Visible = false;
  17. }
  18.  
  19.  
  20. //csharp/6089

Reply to "Cc code to minimize WinForm program to system tray"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website