-1

I'm working on an application which needs a right click menu, I've used a contextMenuStrip for the this, but when the menu is open and I rightclick again my form click events are always one behind so the last event is triggered instead of the current one.

I've tried closing the menu when the right mouse button is pressed and showing it when it's released, but it still does the same thing.

BoJaN
  • 131
  • 1
  • 5
  • Can you post the code that you currently have..? perhaps you are doing something in the wrong order.. – MethodMan Jan 13 '12 at 21:23
  • What does "...always one behind so the last event triggered instead of the current one" mean? – LarsTech Jan 13 '12 at 22:11
  • I'm not great at explaining myself, the problem is similar to this one: http://stackoverflow.com/questions/8568867/click-event-delayed-in-contextmenu-attached-to-notifyicon except it happens while the context menu is visible – BoJaN Jan 20 '12 at 19:27

1 Answers1

0

I figured out the problem, I was updating the mouse position in an onMouseMove event and keeping it in my static MouseState class and the onMouseMove event wasn't happening while the context menu was up. I'm now updating the mouse on mouse down/up/move using form.PointToClient(Cursor.Position)

Hope this helps others with similar issues.

BoJaN
  • 131
  • 1
  • 5