Form.MdiParent 속성

정의

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

public:
 property System::Windows::Forms::Form ^ MdiParent { System::Windows::Forms::Form ^ get(); void set(System::Windows::Forms::Form ^ value); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.Form MdiParent { get; set; }
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.Form? MdiParent { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.MdiParent : System.Windows.Forms.Form with get, set
Public Property MdiParent As Form

속성 값

Form

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

특성

예외

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

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

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

예제

다음 예제에서는 MDI 애플리케이션에서 자식 양식을 만드는 방법을 보여 줍니다. 예제 코드는 고유한 텍스트가 있는 양식을 만들어 자식 양식을 식별합니다. 이 예제에서는 MdiParent 속성을 사용하여 폼이 자식 폼임을 지정합니다. 이 예제에서는 해당 속성이 설정된 trueIsMdiContainer 에서 예제의 코드를 호출하고 폼에 이름이 지정된 childCount프라이빗 클래스 수준 정수 변수가 있어야 합니다.

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.Text = formText;

   // Make the new form a child form.
   child.MdiParent = this;
   // Display the child form.
   child.Show();
}
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

설명

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

참고

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

적용 대상

추가 정보