Introducing MDI Applications

Many of the applications that you create in Visual Basic consist of a series of independent forms. Each of these forms is displayed separately on the screen and is moved, maximized, or minimized separately from any other form. With this type of interface, you cannot easily organize the forms or deal with them as a group. Even with this limitation, this interface is a good one to use for many programs and is probably the most prevalent interface design.

An alternative to this standard interface is the Multiple-Document Interface, or MDI. This type of application has one parent form that contains most of the other forms in the program. Other forms can be child forms, which are contained within the parent, or standard forms, which are not. With an MDI application, you can easily organize all the child forms or minimize the entire group of forms just by minimizing the parent form. Programs such as Microsoft Word and Excel are examples of MDI applications. If you have worked with these programs, you know that you can open multiple windows in the program, access them easily from the menu, and minimize the whole thing with a single click of the mouse. In version 5, even Visual Basic went to a true MDI interface style.

Characteristics of MDI Parent Forms

The MDI form, also known as the parent form, is the container for all the child forms of the application. The MDI form has a number of characteristics that define its behavior. They are as follow:

  • An application can have only one MDI form.
  • The MDI form can contain only those controls that support the Align property, such as the PictureBox or Toolbar controls. You cannot place other controls on the MDI form.
  • You cannot use the Print method or any of the graphics methods to display information on the MDI form.

  • The MDI parent window and all child windows are represented by a single icon on the Windows taskbar. If the parent form is minimized and then restored, all the child forms are returned to the same layout as they had before the application was minimized.
  • If a menu is defined for a child form, the menu is displayed in the parent form’s menu bar. If a menu is defined for the parent form, it is not shown at all if a child form that has its own menu is the active form.

Characteristics of MDI Child Forms

Just as the MDI form has characteristics of its behavior, the MDI child forms also behave in a certain way. The characteristics of an MDI child form are as follow:

  • Each child form is displayed within the confines of the parent form. A child form cannot be moved outside the boundaries of the MDI parent form.
  • When a child window is minimized, its icon is displayed in the parent window, not on the Windows taskbar.
  • When a child form is maximized, it fills the entire inner area of the parent form. Also, the parent form’s title bar contains both the name of the parent form and the name of the maximized child form.
  • When one child form is maximized, all other child forms are maximized as well.
Top Home