Make System Tray Based Application in .NET

Creating an application that lives in the system tray is easy, but it is not entirely obvious how to do so in Visual Studio. This recipe will show you the steps.


1) First, create a new Windows Application project in Visual Studio.NET. This can be either Visual Basic or C#

2) Drag a Notifyicon control and a ContextMenu control from the toolbox onto the form.

3) Click on the NotifyIcon control that you just added, and set the Icon property to whatever icon you want your application to have.

4) Set the ContextMenu property of the Notifyicon to the context menu that you added to your project.

5) Right click on the Context Menu control, and select Edit. Since this menu will be the right-click menu for your tray icon, you will want to add the items that the user will see. Make sure to add an Exit menu item.

6) Double click the Exit menu item, and add the following code:this.Close();

7) Now for the important settings. Click on the form, and go to the Properties window. Set the following settings:
FormBorderSize: Fixed Tool Window
WindowState: Minimized
Opacity: 0%
ShowInTaskbar: False

The key thing to remember is that the default form is not to be used for application functionality, it is only used as the hidden background window. If you want to create a new window, you can just add another form to your application.

The Conversation

Follow the reactions below and share your own thoughts.

15 Responses to “Make System Tray Based Application in .NET”

  1. December 01, 2008 at 7:35 am, Amrita said:

    That is cool!!!

    Reply

  2. April 22, 2009 at 3:30 pm, 0p1e said:

    Awesome, just what I needed.
    Thanks!

    Reply

  3. May 08, 2009 at 9:39 pm, Tom said:

    Nice job- thanks for the info!

    Reply

  4. July 04, 2009 at 5:00 pm, TY said:

    THANKS!

    Reply

  5. October 26, 2009 at 1:54 pm, hacker said:

    Thanks! Works perfect!

    Reply

  6. April 28, 2010 at 1:09 pm, Anonymous said:

    thank you.

    Reply

  7. May 04, 2010 at 2:12 pm, None said:

    Just what I needed, much appreciated.

    Reply

    • July 06, 2010 at 10:29 am, Abcd said:

      thank u very much..very good one

      Reply

  8. March 01, 2011 at 9:20 pm, Seth Adam Davis said:

    Wow. Great tut! Easy and straightforward.

    Reply

  9. March 01, 2011 at 10:10 pm, hahahut said:

    Awesome! Just what I need!

    Reply

  10. April 02, 2011 at 8:41 am, John Bryntze said:

    Even I could do it with this description, then anyone can, thanks a lot, this is super cool

    Reply

  11. September 21, 2011 at 9:57 am, ddonate said:

    Thanks a lot!! Easy & complete…

    Reply

  12. December 15, 2011 at 8:44 am, Dave said:

    Thanks so much, I can’t believe how simple it is to get a tray app up and running.

    Reply

  13. May 15, 2012 at 5:48 pm, Chris Luongo said:

    I can definitely find use for this, great quick article johnny helped a lot

    Reply

  14. January 20, 2013 at 11:14 am, Morteza said:

    Very Very Nice
    Thank you

    Reply

Leave a Reply