Creating an icon in the system tray

A standard part of many Windows forms applications is the system tray icon. Most commonly it is used to provide an application or event status. Tray icons are added to an application using the NotifyIcon control. It includes properties that simplify displaying a System Tray icon and the notification "balloon". Once you've added the control to your form, assign an icon (.ico) file or image to its Icon property, and ensure that its “Visible” property is set to “True”.

As an example let’s create a simple application that creates a tray icon using Visual Studio 2008.

Create a new Windows Form project

On the main form add a button and a NotifyIcon to the project.

Update the following properties on the NotifyIcon1 control

In the Button1 code place the following code to make the balloon show for six seconds

Once the application is run and the button is pressed it shows the following