?
Solved

How can I tell when an MDI child is being moved?

Posted on 2006-12-01
5
Medium Priority
?
401 Views
Last Modified: 2008-01-09

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?

0
Comment
Question by:riceman0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 

Author Comment

by:riceman0
ID: 18057980

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.
0
 

Author Comment

by:riceman0
ID: 18058000

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??
0
 
LVL 34

Accepted Solution

by:
Sancler earned 2000 total points
ID: 18058119
I assume, from your reference to Form.MouseCaptureChanged, that you are on VB.NET 2005.  If that's so, have a look at Form.ResizeBegin and Form.ResizeEnd.  They seem to offer just what you want.

Roger
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18058671
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.
0
 

Author Comment

by:riceman0
ID: 18059802
ResizeBegin works okay for me, I'll just remember the position before both resizes and moves, and only use the positions before moves.  Thanks.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question