0

I have made my application minimize to the system tray however when i try to make it shown it does not spend so it gets stuck in the system tray, also if i do not open the notification area multiple system tray icons are visible until you hover over it what am i doing wrong

     {

         notifyIcon1.BalloonTipText = "application running...";
         if (FormWindowState.Minimized == this.WindowState)
         {
             notifyIcon1.Visible = true;
             notifyIcon1.ShowBalloonTip(500);
             this.Hide();
         }
         else if (FormWindowState.Normal == this.WindowState)
         {
             notifyIcon1.Visible = false;
         }
     }

and then show it with

     {
         this.Show();
         this.WindowState = FormWindowState.Normal;

     }

Also how do i go about overriding the form closing so that it sends my application to the system tray

Broken_Code
  • 306
  • 5
  • 19
  • Ok so you read one part of it and think its duplicated how can i stop the user from closing it and minimize it to the system tray.. that part of my question was not in that article also that only covers minimizing and if you had read you would know that i have already minimized it and my problem IS showing it afterwards and stopping the user from ending the application with alt f4 – Broken_Code Apr 30 '14 at 13:57
  • Yes your right ... I will get you an answer – Micah Armantrout Apr 30 '14 at 13:59
  • Implement the FormClosing event and set the e.Cancel property to true. Unless the user asked to close through the context menu. – Hans Passant Apr 30 '14 at 13:59
  • possible duplicate of [How to start WinForm app minimized to tray?](http://stackoverflow.com/questions/1730731/how-to-start-winform-app-minimized-to-tray) – Hans Passant Apr 30 '14 at 14:00
  • so the two make it a dup – Micah Armantrout Apr 30 '14 at 14:00
  • Ok and why do two icons show when i check the system tray? – Broken_Code Apr 30 '14 at 14:10

0 Answers0