"Colin McGuire" <colinandkaren@lycos.co.uk> schrieb[color=blue]
> Hi again, thanks everyone for your previous help. But having
> resolved past problems, I'm moving on to new problems :(
>
> This one is a simple winforms application with two buttons, named
> Button1 and Button2, on it (code below). When I press the mouse
> button over Button2, and don't release it, in the IDE output window
> it prints "Button2_MouseDown" only. If I release the mouse button
> over the button, over the form, or even over ANY other application
> that is running I also see "Button2_MouseUp" in the output window.
> This is what I want and expected.
>
> But when I do exactly the same for Button1, I don't see this. I
> press button1, don't release the mouse button, a yellow form is
> displayed, and what I am wanting is that when I release the
> mousebutton the yellow form is hidden/disappear. Depending on where I
> release the mouse button seems to change whether the "MouseUp" event
> is fired and therefore whether I hide my yellow form. Why? For
> example, press the left mouse button while over Button1, and keep the
> mousebutton depressed, a yellow backcolor form will be displayed, now
> move the cursor somewhere (over the desktop) still holding down the
> mouse button, release the mouse button, and the "MouseUp" event isn't
> fired! Ha? I want it to be fired so I can hide the yellow form. So
> there has to be a trick - but what is it.[/color]
Whenever you press the mouse button, the control "captures" the mouse, so
all mouse messages will be sent to the button even if the cursor is outside
the button. As soon as you show the Form, the mouse is released. Untested
suggestion: Set Button1.Capture = True after showing the Form.
--
Armin
http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html