How can I hide my VC# applications task bar button and show a system tray icon instead. Then, when I have the icon, how to display notifications like FDM or Windows Update etc, and add right click menu to the icon.
+2
A:
The NotifyIcon class creates an icon in the system tray. As that page indicates, you can create a ContextMenu, which will appear when the user right clicks.
NotifyIcon includes "BalloonTip" properties that can be used to display the messages you're referring to. This example is from the MSDN documentation.
notifyIcon1.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
notifyIcon1.Visible = true;
notifyIcon1.BalloonTipIcon = ToolTipIcon.Error;
notifyIcon1.BalloonTipTitle = "Delayed Write Failed";
notifyIcon1.BalloonTipText = "Some of your data has been lost.";
notifyIcon1.ShowBalloonTip(0);
As @Kobi says, you also want to set your form's ShowInTaskbar property to false.
harpo
2009-08-31 06:24:48
+2
A:
- On your form set
ShowInTaskbar
to false. - Use a control called
NotifyIcon
to add icons to the system tray. It also has an handy ShowBalloonTip method.
Kobi
2009-08-31 06:25:33