Solved

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

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

691 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