Control.Contains(Control) Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
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
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