Freigeben über


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

Comments

  • Anonymous
    December 05, 2007
    PingBack from http://www.absolutely-people-search.info/?p=3624

  • Anonymous
    December 05, 2007
    PingBack from http://www.absolutely-people-search.info/?p=3624

  • Anonymous
    December 05, 2007
    Hi Thom, I noticed your instructions said to create a Windows Forms app - do you know if there's a similar process for WPF apps to work with system tray icons? Cheers, Neil

  • Anonymous
    December 13, 2007
    Thanks for the code I have used it but i could not find any icon on system Tray. can you please tell me how to display application in the System Tray.

  • Anonymous
    December 15, 2007
    Not sure what may be the problem. If you have run the code you should see the icon in the system tray and a balloon that should pop up.

  • Anonymous
    December 19, 2007
    Since a recent problem with my ati driver, i have tried to restore my screen to how i like it. (resolution=1280x1024). However i now have two rows of ridiculously small icons in the Sytem Tray, instead of one row or decent sized ones. There is only ever 7 or 8 'live' icons present. Does anybody know what i have done? And how to get it back to ONE row??