Click here to Skip to main content
15,911,891 members
Home / Discussions / C#
   

C#

 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Tyrus18210-Dec-04 17:03
Tyrus18210-Dec-04 17:03 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Skynyrd10-Dec-04 17:07
Skynyrd10-Dec-04 17:07 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Tyrus18210-Dec-04 17:15
Tyrus18210-Dec-04 17:15 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Tyrus18210-Dec-04 17:14
Tyrus18210-Dec-04 17:14 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Skynyrd10-Dec-04 17:17
Skynyrd10-Dec-04 17:17 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Tyrus18210-Dec-04 17:29
Tyrus18210-Dec-04 17:29 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Tyrus18210-Dec-04 17:44
Tyrus18210-Dec-04 17:44 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Skynyrd10-Dec-04 19:10
Skynyrd10-Dec-04 19:10 
Check my original post. I modified the post and implemented a mouse clipping that prevents u from moving the mouse outside the parentform if a child form is captured.

This only prevents ur mouse exiting the parent form when moving a child. If u want to detect when the child form begins to go past the parent window I would work with screen coordinates similar to what I did with the mouse clipping.

For example: The parent client rectangle in Screen coord would be:

clientRec = new Rectangle(this.MdiParent.PointToScreen(this.MdiParent.ClientRectangle.Location),this.MdiParent.ClientRectangle.Size);

Your child form rectangle (including none client areas) would be:
childRec=new Rectangle(this.PointToScreen(this.Bounds.Location),this.Bounds.Size);

Then it would be a matter of comparing when one crosses over the other. Top, Bottom, Left and Right.

There could be a problem with the parent's client rectangle. Its not always the same size as the MdiChildContainerWindow. Some docked controls like a StatusBar shorten the MdiChildrenWindow but dont afect the form's clientSize.

A way to get around this is to iterate through the control collection of ur parent form until u find the one with the type 'System.Windows.Forms.MdiClient' (You tipically do this after the InitializeComponents method in your constructor and store the MdiClient control in a private class member that u can access whenever u want without having to search through the control collection again and again). This control is automatically added when u set ur form as a MdiContainer. U can then base ur calculations on the MdiClient control's true size and location instead of using the forms ClientRectangle.
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Tyrus18210-Dec-04 19:54
Tyrus18210-Dec-04 19:54 
GeneralRe: MOVING CHILD WINDOWS IN MDI Pin
Skynyrd11-Dec-04 2:08
Skynyrd11-Dec-04 2:08 
GeneralsqlCommand in C# Pin
John L. DeVito10-Dec-04 12:48
professionalJohn L. DeVito10-Dec-04 12:48 
GeneralRe: sqlCommand in C# Pin
Heath Stewart10-Dec-04 13:03
protectorHeath Stewart10-Dec-04 13:03 
GeneralCallContext SerializationException Pin
Skynyrd10-Dec-04 12:48
Skynyrd10-Dec-04 12:48 
GeneralRe: CallContext SerializationException Pin
Heath Stewart10-Dec-04 12:54
protectorHeath Stewart10-Dec-04 12:54 
GeneralRe: CallContext SerializationException Pin
Skynyrd10-Dec-04 13:12
Skynyrd10-Dec-04 13:12 
GeneralRe: CallContext SerializationException Pin
Heath Stewart10-Dec-04 14:28
protectorHeath Stewart10-Dec-04 14:28 
GeneralRe: CallContext SerializationException Pin
Skynyrd10-Dec-04 14:49
Skynyrd10-Dec-04 14:49 
GeneralRe: CallContext SerializationException Pin
Skynyrd10-Dec-04 19:17
Skynyrd10-Dec-04 19:17 
GeneralRe: CallContext SerializationException Pin
Heath Stewart10-Dec-04 20:27
protectorHeath Stewart10-Dec-04 20:27 
GeneralRe: CallContext SerializationException Pin
Skynyrd11-Dec-04 2:31
Skynyrd11-Dec-04 2:31 
GeneralRe: CallContext SerializationException Pin
Skynyrd11-Dec-04 4:20
Skynyrd11-Dec-04 4:20 
GeneralRe: CallContext SerializationException Pin
Heath Stewart11-Dec-04 22:14
protectorHeath Stewart11-Dec-04 22:14 
GeneralRe: CallContext SerializationException Pin
Skynyrd12-Dec-04 9:52
Skynyrd12-Dec-04 9:52 
GeneralVersion information Pin
Einar Kvandahl10-Dec-04 11:25
Einar Kvandahl10-Dec-04 11:25 
GeneralRe: Version information Pin
Robin Panther10-Dec-04 12:00
Robin Panther10-Dec-04 12:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.