• Advertisement
Sign in to follow this  

[.net] mouse event handling

This topic is 4952 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Anyone know how to "clear" pending mouse up/down/move events in C#? Basically I've got a custom control with some mouse handlers. I have a button on the same form which pops up a file dialog. Most of my custom control gets covered by the file dialog when it opens up. When I double click a file to pick, the dialog goes away as it should, but the click also triggers the mouse move and mouse up handlers of my control. I suspect this happens because the mouse events are getting queued somewhere... Anyone run into this before? Thanks

Share this post


Link to post
Share on other sites
Advertisement
nm, I figured it out..
the file dialog goes away on the mouse down. Once its gone, the mouse up event will be over the control. A quick and dirty fix is just to use a global var like:

mousedownhandler(){
isMouseDown = true;

...
}

mouseuphandler(){
if(!isMouseDown)
return;

isMouseDown = false;

...
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement