Solved

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

Posted on 2006-12-01
5
394 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
  • 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 85

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 Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now