Form.ActiveMdiChild Özellik

Tanım

Şu anda etkin olan çoklu belge arabirimi (MDI) alt penceresini alır.

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

Özellik Değeri

Form

Form Şu anda etkin olan MDI alt penceresini veya null şu anda alt pencere yoksa bir döndürür.

Öznitelikler

Örnekler

Aşağıdaki örnek, etkin MDI alt formuna bir başvuru alır ve formdaki tüm TextBox denetimler arasında döngü yapar ve özelliklerini sıfırlar Text . Bu örnek, bir MDI üst formunun oluşturulmasını ve bu yöntem çağrısının MDI üst formundan yapılmasını gerektirir.

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

Açıklamalar

MDI uygulamanızda açık MDI alt formları olup olmadığını belirlemek için bu yöntemi kullanabilirsiniz. MDI alt penceresinde MDI üst formundan veya uygulamanızda görüntülenen başka bir formdan işlemler gerçekleştirmek için de bu yöntemi kullanabilirsiniz.

Şu anda etkin olan form bir MDI alt formu değilse, ona başvuru almak için özelliğini kullanabilirsiniz ActiveForm .

Şunlara uygulanır

Ayrıca bkz.