Saturday, August 09, 2008

image_thumb14

I wanted to add an application I was working on to my Windows Vista’s System Tray. This is one of those things that is completely trivial once you already know how to do it. It’s actually easy enough that most people find their way thorough it on their own, eventually.

Here’s a quick cheat sheet, if you will, that will show you everything you need to know so you can “knock em out da box”, Luke. Smile

First, you’ll need to add a NotifyIcon to the form.

image

Here are the key parts of the NotifyIcon we will be concerned with:

NotifyIcon.Text: Gets or sets the ToolTip text displayed when the mouse pointer rests on a notification area icon.

NotifyIcon.Icon: Gets or sets the current icon.

NotifyIcon.DoubleClick: Occurs when the user double-clicks the icon in the notification area of the taskbar.

NotifyIcon.ContextMenu: Gets or sets the shortcut menu for the icon.

The DoubleClick event is a good place to add logic to open a main form, and the ContextMenu allows the NotifyIcon to almost be an application on its own.

Note:

You can change the NotifyIcon’s Icon at runtime as a way to alert users to various things happening.

It’s good to set any forms in the application to ShowInTaskbar = false. This helps keep clutter out of the user’s taskbar.


Saturday, August 09, 2008 16:43:00 (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |  Trackback
Comments are closed.

Theme design by Jelle Druyts

Pick a theme: