[.net] mouse event handling

Started by
0 comments, last by indigox3 19 years, 8 months ago
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
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;

...
}

This topic is closed to new replies.

Advertisement