1

I have a form which have a NotifyIcon. The form is hiden by default, but the NotifyIcon is visible in the system tray. My question/problem is that when I clicking on the Icon and then clicking away the NotifyIcon's ContextMenuStrip element does not disappearing. I tried LostFocus event, but it does not fires if I click outside of the application.

Is there any solution for this problem? Thank you for the answers in advance!

Code I used:

Private Sub NotifyIcon1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
    If e.Button = MouseButtons.Right Then
        ContextMenuStrip1.Show(Cursor.Position)
    End If
End Sub

Private Sub History_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LostFocus, ContextMenuStrip1.LostFocus
    ContextMenuStrip1.Hide()
End Sub
Pho3nixHun
  • 820
  • 2
  • 11
  • 24

0 Answers0