3

I am working on a Windows application, and when I run this application, there are multiple icons appearing on the tray bar:

and when I mouse-over these icons, they disappear.

Does anybody have any idea why this is happening?

protected override void OnClosed(EventArgs e)
{
    try
    {
        notifyIcon1.Visible = false;
        notifyIcon1.Icon.Dispose();
        notifyIcon1.Dispose();
    }
    catch(Exception ex)
    {
    }
    base.OnClosed(e);
    Environment.Exit(0);
}
G.S Bhangal
  • 3,060
  • 4
  • 23
  • 48

1 Answers1

1

Here is how I close my system tray icon to bring up the full application in a program I wrote a while back:

NOTE: this fits well in an event handler in the code behind, hence this.Show() and this.Activate()

            NotifyIcon sysTrayIcon = sender as NotifyIcon;
            sysTrayIcon.Visible = false;
            this.WindowState = WindowState.Normal;
            this.Show();
            this.Activate();
kformeck
  • 1,703
  • 5
  • 22
  • 43