Control.Show 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.
Menampilkan kontrol kepada pengguna.
public:
void Show();
public void Show();
member this.Show : unit -> unit
Public Sub Show ()
Contoh
Contoh kode berikut menampilkan kotak dialog tentang dan untuk sementara menggambar persegi biru di permukaannya. Contoh ini mengharuskan Anda telah menentukan kelas yang berasal dari Form bernama AboutDialog.
private:
void menuItemHelpAbout_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
{
// Create and display a modeless about dialog box.
AboutDialog^ about = gcnew AboutDialog;
about->Show();
// Draw a blue square on the form.
/* NOTE: This is not a persistent object, it will no longer be
* visible after the next call to OnPaint. To make it persistent,
* override the OnPaint method and draw the square there */
Graphics^ g = about->CreateGraphics();
g->FillRectangle( Brushes::Blue, 10, 10, 50, 50 );
}
private void menuItemHelpAbout_Click(object sender, EventArgs e)
{
// Create and display a modless about dialog box.
AboutDialog about = new AboutDialog();
about.Show();
// Draw a blue square on the form.
/* NOTE: This is not a persistent object, it will no longer be
* visible after the next call to OnPaint. To make it persistent,
* override the OnPaint method and draw the square there */
Graphics g = about.CreateGraphics();
g.FillRectangle(Brushes.Blue, 10, 10, 50, 50);
}
Private Sub menuItemHelpAbout_Click(sender As Object, _
e As EventArgs) Handles menuItemHelpAbout.Click
' Create and display a modless about dialog box.
Dim about As New AboutDialog()
about.Show()
' Draw a blue square on the form.
' NOTE: This is not a persistent object, it will no longer be
' visible after the next call to OnPaint. To make it persistent,
' override the OnPaint method and draw the square there
Dim g As Graphics = about.CreateGraphics()
g.FillRectangle(Brushes.Blue, 10, 10, 50, 50)
End Sub
Keterangan
Menampilkan kontrol setara dengan mengatur Visible properti ke true. Setelah metode dipanggil Show , Visible properti mengembalikan nilai true hingga metode dipanggil Hide .