Hello,
I'm using NotifyIcon (System tray icon) in my WinForms application. I also have a ContextMenuStrip assigned to it. When user right clicks on NotifyIcon this ContextMenuStrip pops up.
These are the only events that NotifyIcon has.
Click
DoubleClick
MouseClick
MouseDoubleClick
MouseDown
MouseMove
MouseUp
This contextMenuStrip items (ToolStripMenuItem) are dynamically generated. I mean there are few default items like 'About','Exit','Help' etc.. but other items are dynamically generated and inserted into this menu when user right clicks on it. I'm generating items and inserting into contextMenuStrip in Click
event handler
Now, I've two problems:
Problem is for an instant its showing the default menustrip and then my
Click
event handler executes and new update menu pops up. How can I avoid this? I don't want to see the default menu at all. In other words I need to override the default behavior.Other problem is since I'm handling the
Click
event (because I didn't find RightClick event) the left button click also is handled by the same handler. I want to do different things (like show application windows) on left click and show dynamically generated contextMenuStrip on right click. How to acheive this?Why are there two different events like
Click
&MouseClick
? What else would we click with? Aren't these two interdependent. I mean when ever there is a MouseClick there is also a Click.
If you can point me to some examples. That would be great!