다음을 통해 공유


Form.IsMdiContainer 속성

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

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
Public Property IsMdiContainer As Boolean
‘사용 방법
Dim instance As Form
Dim value As Boolean

value = instance.IsMdiContainer

instance.IsMdiContainer = value
public bool IsMdiContainer { get; set; }
public:
property bool IsMdiContainer {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_IsMdiContainer ()

/** @property */
public void set_IsMdiContainer (boolean value)
public function get IsMdiContainer () : boolean

public function set IsMdiContainer (value : boolean)

속성 값

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

설명

이 속성은 폼의 표시 형태 및 동작을 MDI 부모 폼의 표시 형태 및 동작으로 변경합니다. 이 속성이 true로 설정되면 해당 폼에 테두리는 볼록하고 클라이언트 영역은 오목하게 표시됩니다. 부모 폼에 할당된 모든 MDI 자식 폼은 해당 클라이언트 영역 내에 표시됩니다.

MDI 부모 폼을 닫으면 MDI 부모 폼의 Closing 이벤트가 발생하기 전에 모든 MDI 자식 폼의 Closing 이벤트가 발생합니다. 또한 모든 MDI 자식 폼의 Closed 이벤트도 MDI 부모 폼의 Closed 이벤트가 발생하기 전에 발생합니다.

예제

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

' 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
// 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.
private Form mdiChildForm = new Form();

private void Form1_Load(Object sender, System.EventArgs e)
{
    // Set the IsMdiContainer property to true.
    set_IsMdiContainer(true);

    // Set the child form's MdiParent property to 
    // the current form.
    mdiChildForm.set_MdiParent(this);

    // Call the method that changes the background color.
    SetBackGroundColorOfMDIForm();
} //Form1_Load

private void SetBackGroundColorOfMDIForm()
{
    for (int iCtr = 0; iCtr < this.get_Controls().get_Count(); iCtr++) {
        Control ctl = this.get_Controls().get_Item(iCtr);
        if (ctl instanceof MdiClient) {
            // If the control is the correct type,
            // change the color.
            ctl.set_BackColor(System.Drawing.Color.get_PaleGreen());
        }
    }
} //SetBackGroundColorOfMDIForm

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

Form 클래스
Form 멤버
System.Windows.Forms 네임스페이스
Form.IsMdiChild 속성
MdiParent
MdiChildren