What needs to be done to have your .NET application show up in Window's system tray as icon?
And how do you handle mousebutton clicks on said icon?
What needs to be done to have your .NET application show up in Window's system tray as icon?
And how do you handle mousebutton clicks on said icon?
You can add the NotifyIcon component from the toolbox onto your main form.
This has events such as MouseDoubleClick that you can use to handle various events.
Edit: You have to make sure that you set the Icon property to a valid .ico file if you want it to show up properly in the systray.
Nice little tutorial on using the NotifyIcon class here: http://www.developer.com/net/csharp/article.php/3336751
Add NotifyIcon component to your form. And use it's events to handle mouse clicks.
First, add a NotifyIcon control to the form. Then wire up the Notify Icon to do what you want.
If you want it to hide to tray on minimize, try this.
Private Sub frmMain_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
If Me.WindowState = FormWindowState.Minimized Then
Me.ShowInTaskbar = False
Else
Me.ShowInTaskbar = True
End If
End Sub
Private Sub NotifyIcon1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
Me.WindowState = FormWindowState.Normal
End Sub
I'll occasionally use the Balloon Text in order to notify a user - that is done as such
Me.NotifyIcon1.ShowBalloonTip(3000, "This is a notification title!!", "This is notification text.", ToolTipIcon.Info)
This shows and handles all the mouse click combinations for NotifyIcon
More here: http://code.msdn.microsoft.com/TheNotifyIconExample