Make System Tray Based Application in .NET

Posted December 20, 2006 by johnnythawte in C programming

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.

  • Amrita

    That is cool!!!

  • 0p1e

    Awesome, just what I needed.

  • Tom

    Nice job- thanks for the info!

  • TY


  • hacker

    Thanks! Works perfect!

  • Anonymous

    thank you.

  • None

    Just what I needed, much appreciated.

    • Abcd

      thank u very much..very good one

  • Seth Adam Davis

    Wow. Great tut! Easy and straightforward.

  • hahahut

    Awesome! Just what I need!

  • John Bryntze

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

  • ddonate

    Thanks a lot!! Easy & complete…

  • Dave

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

  • Chris Luongo

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

  • Morteza

    Very Very Nice
    Thank you