To show the menu when your icon is left-clicked
private void NotifyIcon_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
MethodInfo methodInfo = typeof(NotifyIcon).GetMethod("ShowContextMenu",
BindingFlags.Instance | BindingFlags.NonPublic);
methodInfo.Invoke(this.notifyIcon, null);
}
}
To show the menu when the button in your question is clicked
private void button1_Click(object sender, EventArgs e)
{
//Need to show the context menu here
MethodInfo methodInfo = typeof(NotifyIcon).GetMethod("ShowContextMenu",
BindingFlags.Instance | BindingFlags.NonPublic);
methodInfo.Invoke(this.notifyIcon, null);
}