Bahasa

Control.Contains(Control) Metode

Definisi

Mengambil nilai yang menunjukkan apakah kontrol yang ditentukan adalah anak dari kontrol.

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

Parameter

ctl
Control

Yang Control akan dievaluasi.

Mengembalikan

true jika kontrol yang ditentukan adalah anak dari kontrol; jika tidak, false.

Contoh

Contoh kode berikut memastikan bahwa terlihat Label dengan memanggil metodenya BringToFront . Contoh ini mengharuskan Anda memiliki Form dengan Panel bernama panel1, dan bernama Labellabel1.

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

Berlaku untuk

Lihat juga