Form.IsMdiContainer 속성

정의

폼이 MDI(다중 문서 인터페이스) 자식 폼의 컨테이너인지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool IsMdiContainer { bool get(); void set(bool value); };
public bool IsMdiContainer { get; set; }
member this.IsMdiContainer : bool with get, set
Public Property IsMdiContainer As Boolean

속성 값

폼이 MDI 자식 폼의 컨테이너인 경우 true이고, 그렇지 않으면 false입니다. 기본값은 false입니다.

예제

다음 예제에서는 사용 하는 방법을 보여 줍니다는 IsMdiContainer 속성을 MDI 폼의 속성을 변경 BackColor 합니다. 이 예제를 실행하려면 다음 코드를 새 양식에 붙여넣습니다.


// 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;
        }
    }
}

' 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

설명

이 속성은 폼의 표시 및 동작을 MDI 부모 양식으로 변경합니다. 이 속성을 로 true설정하면 양식에 테두리가 높아진 침몰된 클라이언트 영역이 표시됩니다. 부모 양식에 할당된 모든 MDI 자식 양식이 클라이언트 영역 내에 표시됩니다.

MDI 부모 폼이 닫힌 Closing 경우 MDI 부모 폼의 이벤트가 발생하기 전에 모든 MDI 자식 폼의 Closing 이벤트가 발생합니다. 또한 Closed MDI 부모 양식의 이벤트가 발생하기 전에 Closed 모든 MDI 자식 양식의 이벤트가 발생합니다.

참고

두 개 있는 경우 MenuStrip 설정 하는 MDI 자식 폼의 컨트롤 IsMdiContainertrue 부모 폼 병합 중 하나만 내용의 MenuStrip 컨트롤입니다. 사용 하 여 Merge 내용을 병합 하 여 추가 자식 MenuStrip MDI 부모 폼의 컨트롤입니다.

적용 대상

추가 정보