Most MDI applications give the user the capability of arranging all open child windows in one of several ways, which are normally accessed through a Window menu. Three common window arrangements are Tiled vertically The open child windows are sized as vertical rectangles and arranged side by side. Tiled horizontally The open child windows are sized as horizontal rectangles and arranged on top of one another. Cascaded The child windows overlap each other in a neat cascading pattern, starting at the upper-left of the parent window. In any case, when the open child windows are rearranged, they are all resized to the same dimensions (which may vary slightly when the windows are tiled, depending on how many windows are open and how much space is available). Note Some applications offer a fourth window arrangement option, arrange icons. This arrangement neatly arranges the icons of any minimized documents at the bottom of the parent window. Visual Basic .NET makes it easy for your applications to supply window-arranging capabilities. Simply invoke the parent form's LayoutMdi method (with the appropriate parameter), and the open child windows are automatically arranged neatly. The LayoutMdi method accepts one of the following four parameters (provided via the MdiLayout enumeration): Cascade TileHorizontal TileVertical ArrangeIcons Cascading the Open Child Windows To give the user the ability to cascade open child windows, enter the following code in the Click event handler for the mnuWindowCascade menu item: Me.LayoutMdi(MdiLayout.Cascade) Figure 15.7 illustrates a group of child windows that have been cascaded. Figure 15.7. Cascading causes child windows to be arranged neatly in an overlapping style. Tiling the Open Child Windows Horizontally To let the user tile the open child windows horizontally, enter the following code in the Click event handler for the mnuWindowTileH menu item: Me.LayoutMdi(MdiLayout.TileHorizontal) Figure 15.8 illustrates a group of child windows that have been tiled horizontally. Figure 15.8. Tiling child windows horizontally makes them appear on top of each other. Tiling the Open Child Windows Vertically To let the user tile the open child windows vertically, enter the following code in the Click event handler for the mnuWindowTileV menu item: Me.LayoutMdi(MdiLayout.TileVertical) Figure 15.9 illustrates a group of child windows that have been tiled vertically. Figure 15.9. You can arrange child windows side by side by tiling them vertically. Save and run your program; then test these procedures by creating several new child windows and experimenting with the options under the Window menu. Switching Between Open Windows While you still have the program running with multiple child windows open, notice that the Window menu also maintains a list of the Text properties of all open child windows. You can click any of the windows to bring it to the front and give it the focus. This capability is provided automatically via the MDIList property that you set for the mnuWindow menu item. |