Form.ActiveMdiChild 속성

정의

현재 활성 상태인 MDI(다중 문서 인터페이스) 자식 창을 가져옵니다.

public:
 property System::Windows::Forms::Form ^ ActiveMdiChild { System::Windows::Forms::Form ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.Form ActiveMdiChild { get; }
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.Form? ActiveMdiChild { get; }
[<System.ComponentModel.Browsable(false)>]
member this.ActiveMdiChild : System.Windows.Forms.Form
Public ReadOnly Property ActiveMdiChild As Form

속성 값

Form

현재 활성 상태인 MDI 자식 창을 나타내는 Form을(를) 반환하고 현재 자식 창이 없는 경우 null을(를) 반환합니다.

특성

예제

다음은 현재 MDI 자식 폼에 대한 참조를 가져오고 폼의 모든 TextBox 컨트롤을 반복하여 속성을 다시 설정하는 Text 예제입니다. 이 예제에서는 MDI 부모 폼을 만들고 MDI 부모 폼에서 이 메서드 호출을 수행해야 합니다.

public:
   void ClearAllChildFormText()
   {
      
      // Obtain a reference to the currently active MDI child form.
      Form^ tempChild = this->ActiveMdiChild;
      
      // Loop through all controls on the child form.
      for ( int i = 0; i < tempChild->Controls->Count; i++ )
      {
         
         // Determine if the current control on the child form is a TextBox.
         if ( dynamic_cast<TextBox^>(tempChild->Controls[ i ]) )
         {
            
            // Clear the contents of the control since it is a TextBox.
            tempChild->Controls[ i ]->Text = "";
         }

      }
   }
public void ClearAllChildFormText()
 {
    // Obtain a reference to the currently active MDI child form.
    Form tempChild = this.ActiveMdiChild;
    
    // Loop through all controls on the child form.
    for (int i = 0; i < tempChild.Controls.Count; i++)
    {
       // Determine if the current control on the child form is a TextBox.
       if (tempChild.Controls[i] is TextBox)
       {
          // Clear the contents of the control since it is a TextBox.
          tempChild.Controls[i].Text = "";
       }
    }
 }
Public Sub ClearAllChildFormText()
    ' Obtain a reference to the currently active MDI child form.
    Dim tempChild As Form = Me.ActiveMdiChild
    
    ' Loop through all controls on the child form.
    Dim i As Integer
    For i = 0 To tempChild.Controls.Count - 1
        ' Determine if the current control on the child form is a TextBox.
        If TypeOf tempChild.Controls(i) Is TextBox Then
            ' Clear the contents of the control since it is a TextBox.
            tempChild.Controls(i).Text = ""
        End If
    Next i
End Sub

설명

MDI 애플리케이션에서 열려 있는 MDI 자식 폼 있는지 확인 하려면이 메서드를 사용할 수 있습니다. 또한 애플리케이션에 표시 되는 또 다른 형태 또는 MDI 부모 폼에서 MDI 자식 창에 대 한 작업을 수행 하려면이 메서드를 사용할 수 있습니다.

현재 활성 양식이 MDI 자식 폼이 아닌 경우 이 속성을 사용하여 ActiveForm 참조를 가져올 수 있습니다.

적용 대상

추가 정보