problem on Left-click NotifyIcon to show contextmenustrip

Here is my code

private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
{

notifyIcon1.ContextMenuStrip.Show();

}

When i right-click the notify icon, it works to show the context menu.

When i left-click the notify icon, it also works to show the context menu but some other thing happens unexpectedly.

It also show a main form on the windowns taskbar.

I don't know why. Can someone figure out this for me?

Thanks.

[489 byte] By [nemokao] at [2007-12-24]
# 1

the common way to handle such a situation is set the notifyIcon.ContextMenuStrip property as contextMenuStrip1. Then the icon will respond the right-click event whereas ignore the left-click event.

gqlu at 2007-10-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2

if you like, check what mousebutton was pressed. If it's right then execute the code:

if (e.Button == MouseButtons.Right)

{

this.notifyIcon1.ContextMenuStrip.Show();

}

ahmedilyas at 2007-10-8 > top of Msdn Tech,Windows Forms,Windows Forms General...