Solved

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

Posted on 2006-12-01
5
399 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 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

738 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