Link to home
Start Free TrialLog in
Avatar of cas1
cas1Flag for Germany

asked on

Detect if mouse button was released

Hi,

Who can tell me, how I can react on when the user releases the left mouse button. My Problem is the following:
I want to implement a function where the user can draw a free rectangle. The drawing should begin by pressing the mouse button and should be finished by releasing. With the mousemove the rectangle should resize. I know that I can use the mousemove event of a container, but I can't handle it if the user releases over another control. And what event occurs if the user does not move the mouse anymore and releases the button then?

Please help me
Avatar of cas1
cas1
Flag of Germany image

ASKER

Edited text of question.
ASKER CERTIFIED SOLUTION
Avatar of s_lavie
s_lavie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jeremy_D
Jeremy_D

The control receiving the MouseUp event is the same as the control that received the initial MouseDown event, so if the user presses the mouse-button on the Form and releases it over, say, a command-button, it's still the Form that receives the MouseUp event. So the event you'll probably need is the "Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)"-event (this also works for other containers like a PictureBox).
    The MouseUp- and MouseDown-events get a Button parameter which is 1 if the user pressed (or released) the left mouse-button.

Hope this helps,
Jeremy

Avatar of cas1

ASKER

Oh, my dear! I grasped that there is a mouse up event at nearly each control. Shame over me, but I'm a bloody beginner. Thanx to jeremy, too
Damn (pardon my french) s_lavie. if IE5 didn't hang so much I would have been 6 minutes before you!  ;-)
Jeremy

Avatar of cas1

ASKER

Sorry. Jeremy but maybe the next question is as easy as the last one