1
votes

This question applies to two scenarios.

(1)

The first is having a MDI Form and MDI Child, At runtime if I try to resize the Form either horizontally or vertically I cannot go past the edge of the main MDI Form, somewhere there must be a SetBounds or something similar that prevents this type of behavior as the mouse just snaps to the edge.

What I would like is to be able to resize past/outside the MDI Form bounds rect - which would then show the scrollbars on the main MDI Form (just like when you move a Child Form around).

(2)

The second is I find the scrolling within a MDI layout application a bit annoying and not very pleasing to use, so instead of using MDI I thought I could simulate it by setting a Form inside a TScrollBox, doing this I hoped would give more better fluid scrolling. But as with the first scenario placing a Form inside a ScrollBox still does not allow resizing outside the client - and doing this method does not even show the scrollbars when you move the Form around the ScrollBox.


You can try this very quickly by making a new MDI Application. Try resizing using the bottom right corner and dragging as far to to the right/bottom as you can, the Mouse stops at the main MDI client preventing outside resizing.

So how can I allow at runtime, a Form whether it be a MDI Child or parent to a TScrollBox to be resized outside the parent bounds?

Is there a simple property I need to set that I may have overlooked or does it require more work to do such as overriding the Form's messages maybe?

1
ClipCursor helps set the cursor free, but I haven't got any success with the inner window's borders, WM_GETMINMAXINFO does not help.Sertac Akyuz

1 Answers

1
votes

MDI children are not bound by their parent's size, but they are not visible outside their parent's boundaries and therefor cannot be resized outside of those bounds.

However, you can move them outside of the boundaries, so if you move your child form to the left, leaving only a part of the form visible, you can then resize that visible part upto the boundary of the parent. So there's no really a limit in size, but it's just a functional limitation that you cannot further size the form when it's size handles/borders would become hidden.

I think, rather than placing the MDI child on a scrollbox or resizing the MDI child, you could better put the contents of the child on a scrollbox and leave the child form itself as is.

Or, of course, you could revise the design so that you don't need the scrolling at all, but it's impossible to give a proper advise without knowing your form.