Freigeben über


Control.Contains-Methode

Ruft einen Wert ab, der angibt, ob das angegebene Steuerelement dem Steuerelement untergeordnet ist.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Function Contains ( _
    ctl As Control _
) As Boolean
'Usage
Dim instance As Control
Dim ctl As Control
Dim returnValue As Boolean

returnValue = instance.Contains(ctl)
public bool Contains (
    Control ctl
)
public:
bool Contains (
    Control^ ctl
)
public boolean Contains (
    Control ctl
)
public function Contains (
    ctl : Control
) : boolean

Parameter

Rückgabewert

true, wenn das angegebene Steuerelement dem Steuerelement untergeordnet ist, andernfalls false.

Beispiel

Im folgenden Codebeispiel wird durch Aufruf der BringToFront-Methode sichergestellt, dass ein Label sichtbar ist. Bei diesem Beispiel muss in einem Form ein Panel mit der Bezeichnung panel1 und ein Label mit der Bezeichnung label1 vorhanden sein.

Private Sub MakeLabelVisible()
   ' If the panel contains label1, bring it 
   ' to the front to make sure it is visible. 
   If panel1.Contains(label1) Then
      label1.BringToFront()
   End If
End Sub
private void MakeLabelVisible()
{
   /* If the panel contains label1, bring it 
   * to the front to make sure it is visible. */
   if(panel1.Contains(label1))
   {
      label1.BringToFront();
   }
}
private:
   void MakeLabelVisible()
   {
      
      /* If the panel contains label1, bring it
         * to the front to make sure it is visible. */
      if ( panel1->Contains( label1 ) )
      {
         label1->BringToFront();
      }
   }
private void MakeLabelVisible()
{
    /* If the panel contains label1, bring it 
       to the front to make sure it is visible. 
     */
    if (panel1.Contains(label1)) {
        label1.BringToFront();
    }
} //MakeLabelVisible

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

Control-Klasse
Control-Member
System.Windows.Forms-Namespace
Contains
Controls
Parent