riceman0
asked on
How can I tell when an MDI child is being moved?
Is there a way to definitievely tell when an MDI child form is starting to move, is moving, and when the user has finished moving? This could be limited to when the user clicks on the title bar and drags it (rather than programmatically, I guess), if necessary.
I have been playing around with the Move event and the MouseCaptureChanged event, but these (MouseCaptureChanged especially) are strange and can't seem to nail down the actual events I want. What's the capital-R Right way to do this?
ASKER
Maybe one way to do this is this:
Is Form.MouseCaptureChanged called both when the form receives and loses the capture? If so, how do I distingusih the two events??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You'll also need the Move() or the LocationChanged() event.
So just pass the form to your central class and then use AddHandler() to wire those events up in it.
Unfortunately the ResizeBegin()/ResizeEnd() events also fire when the form is resized (thus the name) as well as moved so you won't be able to tell the difference between the two.
So just pass the form to your central class and then use AddHandler() to wire those events up in it.
Unfortunately the ResizeBegin()/ResizeEnd() events also fire when the form is resized (thus the name) as well as moved so you won't be able to tell the difference between the two.
ASKER
ResizeBegin works okay for me, I'll just remember the position before both resizes and moves, and only use the positions before moves. Thanks.
ASKER
By the way, I need to know the exact spot that the move started, since in some cases I want to restore to the pre-move location. I don't think trapping the first Move event will accomplish this...
Another constraint: I don't think I want to override the WndProc procedure to get a mouse click on the title bar (that's how you do that, right?) I am handling all this through a separate, central class to which I am passing a reference to each child form. I do not think I can intercept WndProc messages through a reference (using AddHandler or something), correct? Hope that makes sense.