True tiling of MDI forms?

  • Thread starter Thread starter Jim Hubbard
  • Start date Start date
J

Jim Hubbard

By true tiling I don't mean the vertical or horizontal tiling that is
normally though of like...

123

or

1
2
3

rather, I would like to know how to tile like

1 2
3 4

.......any ideas?
 
Well if you haven't already had a look at the MdiLayout enumeration, i'd
suggest you start there.
The basic idea behind what your looking to do is not availbale via this
enumeration, but would be dead simple to custom code. It would go something
like:


Private Sub OnCustomLayout(children as form(), heightStack as integer,
widthStack as integer)

if children is nothing orelse children.length then throw
ArgumentNullException("children", "I know children should be seen and not
heard but this just plain rediculous.")

if heightStack<=0 orelse widthStack <=0 then throw
ArgumentOutOfRange("Message here")

dim recs(children.length-1) as new Rectangle
dim i, childHeight, childWidth as integer


1. Divide MDIParent height by heightStack = childHeight
2. Divide MDIParent widht by width stack. = childWidth

I'd round up for 1/2 so you are assured of fitting all windows in MDIParent
(you can adjust final window to fill all remaining space if any)

3 . Create a rectangle which basically just a size and location (which you
offset per rectangle) starting at (0,0)
and add to recs.

4. Then just assign the size and location to each child window by looping
through Mdi children / recs array.

' You wouldn;t even necessarily need the recs array but it keeps things tidy
and you can resort your windows or whatever using it... so long as the
number of child window doesn;t change.

End Sub



hth
Richard
 
Back
Top