I am new to WinForms events and I am getting a strange error.Well I write when I start my control:
this.MouseUp += MouseUpMethod;
But the problem is, when I release the mouse button out of my control, the program recognize as I release the mouse over the Control. I am not able to understand this error. Did ever someone got this error?
It's because, by default, your control captures mouse. Just set Control.Capture to
false
somewherein yourMouseDown
event handler, for example:As alternative just check in
MouseUp
that mouse is still inside your control: