다음을 통해 공유


Form.MdiParent 속성

이 폼의 현재 MDI(다중 문서 인터페이스) 부모 폼을 가져오거나 설정합니다.

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

구문

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

value = instance.MdiParent

instance.MdiParent = value
public Form MdiParent { get; set; }
public:
property Form^ MdiParent {
    Form^ get ();
    void set (Form^ value);
}
/** @property */
public Form get_MdiParent ()

/** @property */
public void set_MdiParent (Form value)
public function get MdiParent () : Form

public function set MdiParent (value : Form)

속성 값

MDI 부모 폼을 나타내는 Form입니다.

예외

예외 형식 조건

Exception

이 속성에 할당된 Form이 MDI 컨테이너로 표시되지 않은 경우

- 또는 -

이 속성에 할당된 Form이 자식 폼이면서 MDI 컨테이너 폼인 경우

- 또는 -

이 속성에 할당된 Form이 다른 스레드에 있는 경우

설명

MDI 자식 폼을 만들려면 MDI 부모 폼이 될 Form을 자식 폼의 MdiParent 속성에 할당합니다. MDI 자식 폼에서 이 속성을 사용하여 모든 자식 폼에 필요한 전역 정보를 얻거나 모든 자식 폼에 대해 작업을 수행하는 메서드를 호출할 수 있습니다.

예제

다음 코드 예제에서는 MDI 응용 프로그램에서 자식 폼을 만드는 방법을 보여 줍니다. 이 예제 코드에서는 자식 폼을 식별하기 위한 고유 텍스트를 포함하는 폼을 만듭니다. 또한 MdiParent 속성을 사용하여 폼이 자식 폼임을 지정합니다. 이 예제를 실행하려면 해당 IsMdiContainer 속성이 true로 설정되어 있고 childCount라는 전용 클래스 수준의 정수 변수가 있는 폼에서 예제의 코드를 호출해야 합니다.

Private Sub CreateMyChildForm()
   ' Create a new form to represent the child form.
   Dim child As New Form()
   ' Increment the private child count.
   childCount += 1
   ' Set the text of the child form using the count of child forms.
   Dim formText As String = "Child " + childCount.ToString()
   child.Text = formText

   ' Make the new form a child form.
   child.MdiParent = Me
   ' Display the child form.
   child.Show()
End Sub
private void CreateMyChildForm ()
{
   // Create a new form to represent the child form.
   Form child = new Form();
   // Increment the private child count.
   childCount++;
   // Set the text of the child form using the count of child forms.
   String formText = "Child " + childCount;
   child.Text = formText;

   // Make the new form a child form.
   child.MdiParent = this;
   // Display the child form.
   child.Show();
}
private:
   void CreateMyChildForm()
   {
      // Create a new form to represent the child form.
      Form^ child = gcnew Form;

      // Increment the private child count.
      childCount++;

      // Set the text of the child form using the count of child forms.
      String^ formText = String::Format( "Child {0}", childCount );
      child->Text = formText;

      // Make the new form a child form.
      child->MdiParent = this;

      // Display the child form.
      child->Show();
   }
private void CreateMyChildForm()
{
    // Create a new form to represent the child form.
    Form child = new Form();

    // Increment the private child count.
    childCount++;

    // Set the text of the child form using the count of child forms.
    String formText = "Child " + childCount;
    child.set_Text(formText);

    // Make the new form a child form.
    child.set_MdiParent(this);

    // Display the child form.
    child.Show();
} //CreateMyChildForm

.NET Framework 보안

플랫폼

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 속성
Form.IsMdiContainer 속성
Form.MdiChildren 속성