Control.Contains(Control) Método

Definição

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

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

A Control avaliar.

Devoluções

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

Exemplos

O seguinte exemplo de código garante que a Label é visível ao chamar o seu BringToFront método. Este exemplo exige que tenhas um Form com um Panel nome panel1, e um Labellabel1nome .

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

Ver também