Add context menu with left mouse button to notification icon

The notifyIcon function is disabled in the taskbar, the user clicks on it, how do I show the context menu after left-clicking?

Also, how to get him to leave with another left hand somewhere else?

Thanks at Advance ...!

+3
source share
1 answer

If you use Visual Studio it is very simple, just add the notification icon to the form in the IDE, then add the contextmenu element.

to see the notification icon, it must have an icon (.ico), and the context menu must be filled with the menu structure.

ContectMenuStrip i.e Contextmenue1. , , , ,

, , ,

Private Sub NotifyIcon1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NotifyIcon1.Click

    ContextMenuStrip1.Show(Control.MousePosition)

End Sub

, , , , click

Private Sub Form1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseClick
    If ContextMenuStrip1.Visible = True Then
        ContextMenuStrip1.Visible = False

    End If
End Sub

, , , , ,

 Private Sub ContextMenuStrip1_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContextMenuStrip1.MouseLeave
    ContextMenuStrip1.Close()


End Sub

, ,

+2

Source: https://habr.com/ru/post/1793245/


All Articles