I would like to create a program to run from the bottom right system tray of Windows.
But I don't know where to start from?
Can someone tell \ show me where to look and examples or what commands to use \ research ?
I would like to create a program to run from the bottom right system tray of Windows.
But I don't know where to start from?
Can someone tell \ show me where to look and examples or what commands to use \ research ?
Add a NotifyIcon
to the main windows form.
Use the Resize
event in Form
to control when to show the NotifyIcon
and hide the form:
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
If Me.WindowState = FormWindowState.Minimized Then
NotifyIcon1.Visible = true
Me.Hide()
NotifyIcon1.BalloonTipText = "Hi from right system tray"
NotifyIcon1.ShowBalloonTip(500)
End If
End Sub
Use the events in NotifyIcon to show the form again:
Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick
Me.Show()
Me.WindowState = FormWindowState.Normal
NotifyIcon1.Visible = False
End Sub
You can download a full example in AutoDNIE google code project
I review the answers I note that miss the icon.
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
If Me.WindowState = FormWindowState.Minimized Then
NotifyIcon1.Visible = True
NotifyIcon1.Icon = SystemIcons.Application
NotifyIcon1.BalloonTipIcon = ToolTipIcon.Info
NotifyIcon1.BalloonTipTitle = "Verificador corriendo"
NotifyIcon1.BalloonTipText = "Verificador corriendo"
NotifyIcon1.ShowBalloonTip(50000)
'Me.Hide()
ShowInTaskbar = False
End If
End Sub
Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick
'Me.Show()
ShowInTaskbar = True
Me.WindowState = FormWindowState.Normal
NotifyIcon1.Visible = False
End Sub
You can also do:
Sub ToggleHide()
If Me.WindowState = FormWindowState.Normal Then
Me.ShowInTaskbar = False
Me.WindowState = FormWindowState.Minimized
Else
Me.ShowInTaskbar = True
Me.WindowState = FormWindowState.Normal
End If
End Sub