Search code examples
c#windowssystem-tray

How to handle events for icon tray in windows using C#


Can any body tell me how to handle events for System tray in windows.

I mean, when some body clicks on the system tray icon then I want to check whether to enable the application or not. Is there any way to capture events corresponding to system tray click.


Solution

  • In a .NET Forms Application the System Tray control { NotifyIcon } provides following Events to check what you want to achieve:

    • Click
    • DoubleClick
    • MouseClick
    • MouseDoubleClick

    You can put the logic into these event handlers.

    I hope this one helps out!