Form.ActiveMdiChild Eigenschaft
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Ruft das derzeit aktive MDI-Untergeordnete Fenster (Multiple-Document Interface) ab.
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
Eigenschaftswert
Gibt einen Form Wert zurück, der das derzeit aktive untergeordnete MDI-Fenster darstellt oder null wenn derzeit keine untergeordneten Fenster vorhanden sind.
- Attribute
Beispiele
Das folgende Beispiel ruft einen Verweis auf das aktive untergeordnete MDI-Formular ab und durchläuft alle TextBox Steuerelemente im Formular, wobei die Text Eigenschaften zurückgesetzt werden. Dieses Beispiel erfordert, dass ein übergeordnetes MDI-Formular erstellt wurde und dass dieser Methodenaufruf aus dem übergeordneten MDI-Formular erfolgt.
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
Hinweise
Mit dieser Methode können Sie ermitteln, ob in Ihrer MDI-Anwendung untergeordnete MDI-Formulare geöffnet sind. Sie können diese Methode auch verwenden, um Vorgänge in einem untergeordneten MDI-Fenster aus dem übergeordneten MDI-Formular oder aus einem anderen Formular auszuführen, das in Ihrer Anwendung angezeigt wird.
Wenn das derzeit aktive Formular kein untergeordnetes MDI-Formular ist, können Sie die ActiveForm Eigenschaft verwenden, um einen Verweis darauf zu erhalten.