Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
NotifyIcon1.Visible = False
End Sub
' 点击关闭时最小化到System Tray,而不关闭
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If boolClose = False Then
e.Cancel = True
Me.Visible = False
NotifyIcon1.Visible = True
End If
End Sub
' 点击System Tray图标时显示主窗体
Private Sub NotifyIcon1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
If e.Button = Windows.Forms.MouseButtons.Left Then
Me.Visible = True
NotifyIcon1.Visible = False
End If
End Sub