4

When either hiding my tray icon and closing the application, half the time my application's tray icon gets 'stuck'. Meaning doesn't leave until you mess around in the tray area.

I know that to clean up during closing I can do trayIcon.Dispose() but that only works for when i close my C# application, and not for when I hide (trayIcon.Visible = false) it.

Does anyone know of a hack, or anyway at all, that can be used to refresh the tray area, or just make sure my icon actually stops displaying?

mattsven
  • 22,305
  • 11
  • 68
  • 104
  • 1
    So your tray icon hangs around during a normal run of your application? It's quite normal for the icon to stay around when debugging if you bail out before the app. can quit normally. – Will A May 22 '11 at 03:48
  • Sorry, I rephrased that first part to be more clear. I meant often times the tray icon does not actually disappear or hide itself when you close the application or hide the tray icon. – mattsven May 22 '11 at 03:51
  • What is a tray icon? Are you talking about the **taskbar notification area**? It's not called the "tray" or "system tray" and it has *never* been called that. Please use precise terminology in your questions to ensure that people know what you're talking about. – Cody Gray - on strike May 22 '11 at 10:04
  • My mistake, I wasn't sure about the "precise terminology". No need to downvote the question or tear into me just because I wasn't aware of that. – mattsven May 22 '11 at 14:06

1 Answers1

6

Refreshing the Taskbar Notification Area in C#

Alex Aza
  • 76,499
  • 26
  • 155
  • 134