Single- and Multiple-Document Interface Applications

Small applications might well reside within a single window, but as applications become larger and more robust, you may find it necessary to create a Multiple-Document Interface (MDI) application capable of opening several windows at once. The main application window of an MDI application is referred to as the parent window , which is able to open several child windows.

The Windows forms in an MDI application are created using the System.Windows.Forms.Form class. You need to know the following main points about an MDI application:

  • The child windows are limited to their parent window. You cannot move child windows outside of the main application window.

  • The parent window can open several types of child windows.

  • Child windows can be opened, closed, maximized, or minimized independently of each other. When the parent window is closed, the child windows are automatically closed.

  • The MDI frame should have a menu. One common menu in an MDI application is the Window menu, which allows a user to manipulate windows opened in the MDI container (parent) form.

To create an MDI parent form, create a Windows form and change its IsMdiContainer property to True. To create an MDI child form, create a Windows form and assign the name of the MDI parent form to its MdiParent property. You can only set the MdiParent property in code, not from the Properties window. Normally, you'll do this in code, after creating a new child form. For example, this code snippet creates a child of the current form:

 Dim f As frmChild = New frmChild() f.MdiParent = Me 

Table 2.28 summarizes the important members of the Form class related to the MDI forms.

Table 2.28. Important Members of the Form Class Related to MDI Applications

Member

Type

Description

ActiveMdiChild

Property

The currently active MDI child window

IsMdiContainer

Property

Specifies whether the form is a container for MDI child forms

MdiChildActivate

Event

Fires when an MDI child form is activated or closed within an MDI application

MdiChildren

Property

An array of forms representing the MDI child form of the parent form

MdiParent

Property

Specifies the MDI parent form for the current form

LayoutMdi

Method

Arranges the MDI child forms within an MDI parent



Developing and Implementing WindowsR-based Applications with Visual BasicR. NET and Visual StudioR. NET Exam CramT 2 (Exam 70-306)
Developing and Implementing WindowsR-based Applications with Visual BasicR. NET and Visual StudioR. NET Exam CramT 2 (Exam 70-306)
ISBN: N/A
EAN: N/A
Year: 2002
Pages: 188

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net