Form Concepts CodeSample - MDI form implementation

From Visual WebGui Wiki

Jump to: navigation, search


Contents

Overview

This article is a part of Form Concepts series of articles.

This codesample is a very simple example on what properties need to be set to have an MDI implementation with a MDI parent and MDI slave forms.

General

To make a form a MDI container form, you only have to set one property, IsMdiContainer = True. Then for every child form you add to that MDI container, you need to set MdiParent reference to that of the parent form.

VB.NET Code

Dim MP As MDIParentForm = New MDIParentForm
MP.IsMdiContainer = True
MP.Show()
For i As Integer = 1 To 3
    Dim f As SlaveForm = New SlaveForm
    f.MdiParent = MP
    f.Location = New System.Drawing.Point(10 + i * 20, 35)
    f.Show()
Next

C# Code

Personal tools