JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using the NotifyIcon Class

I've used notify icons for a while, but I still think they're cool. Notify icons display icons in the Windows system tray; you can handle events like Click and DoubleClick for these icons, displaying a control panel, for example. As mentioned in the In Depth section of this chapter, this is a great feature for processes that run in the background and don't have their own windows, although they may be parts of applications that do display windows. Visual Basic .NET now lets you create Windows services, which run in the background and can display control panels (much like Microsoft SQL Server). You can use notify icons to let the user open such control panels. You can see a notify icon right next to the time of day in Figure 8.5; here's the class hierarchy of the NotifyIcon class:

Object
   MarshalByRefObject
      Component
         NotifyIcon

You can find the more notable public properties of the NotifyIcon class in Table 8.17 and the more notable events in Table 8.18.

Table 8.17: Noteworthy public properties of NotifyIcon objects.

Property

Means

ContextMenu

Gets/sets the context menu for the tray icon.

Icon

Gets/sets the current icon.

Text

Gets/sets the ToolTip text which is to be displayed when the mouse hovers over a system tray icon.

Visible

Gets/sets if the icon is visible in the Windows System Tray.

Table 8.18: Noteworthy public events of NotifyIcon objects.

Event

Means

Click

Occurs when the user clicks the system tray icon.

DoubleClick

Occurs when the user double-clicks the system tray icon.

MouseDown

Occurs when the user presses the mouse button on the icon in the system tray.

MouseMove

Occurs when the user moves the mouse over the icon in the system tray.

MouseUp

Occurs when the user releases the mouse button over the icon in the system tray.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor