TrayIcon Property
This property contains the icon shown in the system tray. This icon is also shown at design time in the right half of the SysTray control. This must be an icon (.ico or .cur file).
Syntax
Set csSysTray[(index)].TrayIcon = icon
The TrayIcon property syntax has these parts:
Part | Description |
csSysTray | The SysTray control you are working with, or a control array of SysTray controls. |
icon | An icon containing the graphic you wish to use in the system tray. |
Settings
The settings for icon are:
Setting | Description |
(None) | (Default) No icon. |
(.ico or .cur file) | Specifies an icon. You can load the icon from the Properties window at design time. At run time, you can also set this property using the LoadPicture function on an icon. |
Examples
Example 1 (setting the system tray icon at run time)
Set csSysTray1.TrayIcon=pctMyPicture.Picture
Example 2 (retrieving the system tray icon at run time)
Set pctMyPicture.Picture=csSysTray1.TrayIcon
Remarks
When setting the TrayIcon property at design time, the graphic is saved and loaded with the form. If you create an executable file, the file contains the image. When you load a graphic at run time, the graphic isn't saved with the application. Use the SavePicture statement to save a graphic from a SysTray control into a file.
Note At run time, the TrayIcon can be set to any other object's DragIcon or Icon property, or you can assign it the graphic returned by LoadPicture.