Control.Contains(Control) Método

Definição

Recupera um valor que indica se o controle especificado é um filho do controle.

public:
 bool Contains(System::Windows::Forms::Control ^ ctl);
public bool Contains (System.Windows.Forms.Control ctl);
public bool Contains (System.Windows.Forms.Control? ctl);
member this.Contains : System.Windows.Forms.Control -> bool
Public Function Contains (ctl As Control) As Boolean

Parâmetros

ctl
Control

O Control a ser avaliado.

Retornos

true se o controle especificado for um filho do controle; caso contrário, false.

Exemplos

O exemplo de código a seguir garante que um Label esteja visível chamando seu BringToFront método . Este exemplo requer que você tenha um Form com um Panel chamado panel1e um Label chamado label1.

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 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

Aplica-se a

Confira também