Hi Greg,
Actually, I found an article in Google Groups that helped by creating a
form control object to reference:
private void ShowMenu()
{
Control control = new Control();
control.CreateControl();
Point menuPos = new Point(Cursor.Position.X, Cursor.Position.Y);
notifyIcon1.ContextMenu.Show(control, menuPos);
}
I still have to run some tests to see what kind of overhead this
produces and how to compensate, but it seems to work. Now the only
problem I have is when the icon is right-clicked, the event is fired
twice (once when right-clicking the icon and once when clicking the menu
option). I just need to figure out how to call a single event
regardless of right or left click.
Thanks for your help.
- Glen
Greg Merideth wrote:
For the NotifyIcon I believe you need to write your own event
handler/message parsing loop and catch the mouse move's when the
NotifyIcon window appears.
Glen wrote:
Can anyone tell me if there is a workable method to get the mouse
cursor position on the screen or the NotifyIcon position? I need to
display a context menu for the NotifyIcon when clicked and I'd like it
to display based on the relative position of the tray icon or mouse
pointer if possible (whichever method works).
Any help would be much appreciated.
- Glen