Sub TileViews() Dim views As New Collection Dim fw As FrameWindow Dim vh As ViewHost, vw As ViewWindow, dh As DockHost Dim rows As Long, cols As Long Dim x As Long, y As Long, i As Long Dim r As DockItem, c As DockItem For Each fw In FrameWork.FrameWindows For Each vh In fw.ViewHosts For Each vw In vh.views views.Add vw Next vw Next vh Next fw If views.Count = 0 Then Exit Sub rows = CLng(Sqr(views.Count)) cols = (views.Count + rows - 1) \ rows Set fw = FrameWork.MainFrameWindow For y = 1 To rows i = (y - 1) * cols + 1 If dh Is Nothing Then If fw.RootDockHost.Orientation = cuiDockHostVertical Then Set vh = fw.RootDockHost.InsertView(views(i), y) Set dh = vh.DockHost Else Set vh = fw.RootDockHost.InsertView(views(i), 0, cuiDockOperationSplitTopLeft) Set dh = vh.DockHost End If Else Set vh = dh.InsertView(views(i), y) End If For x = 2 To cols i = i + 1 If i <= views.Count Then If dh.Children(y).Type = cuiDockItemDockHost Then dh.Children(y).DockHost.InsertView views(i), x Else dh.InsertView views(i), y, cuiDockOperationSplitBottomRight End If End If Next x Next y For Each r In fw.RootDockHost.Children r.RelativeSize = fw.RootDockHost.Position.Height / rows If r.Type = cuiDockItemDockHost Then For Each c In r.DockHost.Children c.RelativeSize = fw.RootDockHost.Position.Width / cols Next c End If Next r End Sub