c# - Minimize my winform application into system tray -


I try to minimize my recommendation application in the tray and when my application is reduced it is still Also open in the task bar and not in the system tray and after automatic shutdown, I control the NotifyIcon and register it in Resize event:

  Private Zero MainWin_Resize (Object Sender, EventArgs e) {If (FormWindowState.Minimized == this.WindowState) {notifyIcon1.Visible = true; NotifyIcon1.ShowBalloonTip (500); This.Hide (); } And if (Forms Vindostat. General == this.WindowState) {notifyIcon1. Person = False; }}  

Try it out:

  Private zeros MainForm_Resize (Object Sender, EventArgs e) {switch (this.WindowState) {Case FormWindowState.Maximized: this.ShowInTaskbar = true; break; Case Form Vindostat At least: this. Shoichtaskbar = False; break; Case FormWindowState.Normal: this.ShowInTaskbar = true; break; Default: Break; }}  

Comments