• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

Arranging Minimized Child Forms

How can I arrange my child forms on a MDIForm so that they are stacked vertically on each other?  I've tried the arrange method but that doesn't seem to be the answer.
0
kevinful
Asked:
kevinful
  • 2
1 Solution
 
supunrCommented:
This might not be what you wanted.  I was not able to stack on top of each other, but I could have them stacking from the top using the code below.

Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long

Private Sub StackWindows()
        Dim f As Form
        Dim topY As Long
       
        'close all opened windows
        topY = 0
        For Each f In Forms
            If (f.Name <> "PLForm") Then
                If f.WindowState = vbMinimized Then
                    MoveWindow f.hwnd, 0, topY, f.Width, f.Height, True
                    topY = topY - 25
                End If
            End If
        Next
End Sub

Hope this is useful.

Good Luck!
0
 
aeklundCommented:
Try this:

Private Sub ArrangeVert(ByRef mdi As MDIForm)
  On Error Resume Next
  Dim i, x, y As Integer
  i = mdi.Height / Forms.Count
  y = 0

  Debug.Print mdi.Top
  For x = 0 To Forms.Count - 1
    If Not Forms(x).MDIChild Then
    Else
      Forms(x).Top = y
      y = y + i
      Forms(x).Left = 0
      Forms(x).Height = i
      Forms(x).Width = mdi.ScaleWidth
    End If
  Next
End Sub
0
 
supunrCommented:
replace "PLForm" with the name of the MDI parent name.
0
 
kevinfulAuthor Commented:
Thanks all!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now