Form.IsMdiContainer 属性ms-help://MS.MSDNQTR.2003FEB.2052/cpref/html/frlrfsystemwindowsformsformclassismdicontainertopic.htm示例
[Visual Basic, C#] 以下代码示例阐释了如何使用 IsMdiContainer 属性和更改 MDI 窗体的 BackColor 属性。要运行该示例,请将以下代码粘贴到一个新窗体中。
[Visual Basic]     ' Create a new form.
    Dim mdiChildForm As New Form    Private Sub Form1_Load(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles MyBase.Load        ' Set the IsMdiContainer property to true.
        IsMdiContainer = True        ' Set the child form's MdiParent property to 
        ' the current form.
        mdiChildForm.MdiParent = Me        'Call the method that changes the background color.
        SetBackGroundColorOfMDIForm()
    End Sub    Private Sub SetBackGroundColorOfMDIForm()
        Dim ctl As Control        ' Loop through controls,  
        ' looking for controls of MdiClient type. 
        For Each ctl In Me.Controls
            If TypeOf (ctl) Is MdiClient Then                ' If the control is the correct type,
                ' change the color.
                ctl.BackColor = System.Drawing.Color.PaleGreen
            End If
        Next    End Sub
[C#]     // Create a new form.
    Form mdiChildForm = new Form();    private void Form1_Load(object sender, System.EventArgs e)
    {        // Set the IsMdiContainer property to true.
        IsMdiContainer = true;        // Set the child form's MdiParent property to 
        // the current form.
        mdiChildForm.MdiParent = this;        // Call the method that changes the background color.
        SetBackGroundColorOfMDIForm();
    }    private void SetBackGroundColorOfMDIForm()
    {
        foreach ( Control ctl in this.Controls )
        {
            if ((ctl) is MdiClient)                // If the control is the correct type,
                // change the color.
            {
                ctl.BackColor = System.Drawing.Color.PaleGreen;
            }
        }    }