Search code examples
vb.netwinformsmdimdiparentmdichild

Winforms MDI "Desktop" Area Boundry


The default MDI parent control has a large "desktop" area that can display multiple child forms. Users can drag forms to the edge of this desktop area so that most of the child form is off the screen. (A scroll bar then appears in the MDI parent) I don't like this feature. Is there a way to lock down the edge of the desktop area so that the child forms remain fully visible?


Solution

    1. Disable the MDI window scrollbars
    2. Hook the OnMove event of all child windows. If the window is moved outside the boundary, "pop" it back along the x and y until it is back inside the parent.