Arranging Minimized Child Forms

Posted on 2003-03-17
Medium Priority
Last Modified: 2010-05-19
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.
Question by:kevinful
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 11

Accepted Solution

supunr earned 400 total points
ID: 8155888
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
End Sub

Hope this is useful.

Good Luck!
LVL 10

Expert Comment

ID: 8155987
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
      Forms(x).Top = y
      y = y + i
      Forms(x).Left = 0
      Forms(x).Height = i
      Forms(x).Width = mdi.ScaleWidth
    End If
End Sub
LVL 11

Expert Comment

ID: 8156064
replace "PLForm" with the name of the MDI parent name.

Author Comment

ID: 8160889
Thanks all!

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question