See Also Example
Arranges the windows or icons within an MDI Form.
Syntax
mdiform.Arrange arrangement
Remarks
The Arrange method has these parts:
Part Description
mdiform Name of the MDI form whose child windows or icons are to be arranged.
arrangement One of the following values that indicate how to arrange windows or icons on an MDI Form:
Symbolic constant | Value | Meaning |
CASCADE | | Cascade all non-minimized MDI child forms. |
TILE_HORIZONTAL | | Tile all non-minimized MDI child forms horizontally. |
TILE_VERTICAL | | Tile all non-minimized MDI child forms vertically. |
ARRANGE_ICONS | | Arrange icons for minimized MDI child forms. |
Windows or icons are arranged even if the MDI form is minimized. Results are visible when the form is next changed from the minimized state
Note Symbolic constants for arrangement definitions can be found in the Visual Basic file CONSTANT.TXT. When placed in any module in a project, the symbolic names can be used in all your form and code modules.
ZOrder Method
The example uses the Arrange method to arrange windows and icons in an MDI form. To try this example, paste the code into the Declarations section of an MDI Form named MDIForm1 that has an MDI child form (named Form1), and a picture box (named Picture1). Then press F5 and click anywhere in the picture box to see the effects of the Arrange method.
Const FORMCOUNT = 5
Dim F(1 To FORMCOUNT) As New Form1
Sub MDIForm_Load ()
Dim I ' Declare local variable.
Load Form1 ' Load original Form1.
For I = 1 To FORMCOUNT
F(I).Caption = "Form" & I + 1 ' Change caption on copies.
Next I
End Sub
Sub Picture1_Click ()
Static ClickCount ' Declare variables.
Dim I, PrevWidth, Start
ClickCount = ClickCount + 1 ' Increment click counter.
Select Case ClickCount
Case 1
MDIForm1.Arrange 1 ' Tile horizontally.
Case 2
MDIForm1.Arrange 2 ' Tile vertically.
Case 3 ' Minimize each form.
PrevWidth = MDIForm1.Width ' Get MDIForm width.
MDIForm1.Width = PrevWidth / 2 ' Divide it in half.
Form1.WindowState = 1 ' Minimize the original.
For I = 1 To FORMCOUNT ' Look at each instance of F.
F(I).WindowState = 1 ' Minimize each copy of F.
Next I
Start = Timer
Do
Loop Until Timer = Start + 5
MDIForm1.Width = PrevWidth ' Resize to original size
MDIForm1.Arrange 3 ' Arrange icons
End Select
End Sub