Control.Contains(Control) Metoda

Definicja

Pobiera wartość wskazującą, czy określona kontrolka jest elementem podrzędnym kontrolki.

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

Parametry

ctl
Control

Wartość Control do oceny.

Zwraca

Boolean

true jeśli określona kontrolka jest elementem podrzędnym kontrolki; w przeciwnym razie , false.

Przykłady

Poniższy przykład kodu gwarantuje, że element Label jest widoczny przez wywołanie metody BringToFront . W tym przykładzie jest wymagany Form element o nazwie panel1i nazwany Label label1.Panel

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

Dotyczy

Zobacz też