Control.Show Método

Definición

Muestra el control al usuario.

C#
public void Show ();

Ejemplos

En el ejemplo de código siguiente se muestra un cuadro de diálogo acerca de y se dibuja temporalmente un cuadrado azul en su superficie. En este ejemplo se requiere que haya definido una clase que derive de Form denominada AboutDialog.

C#
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);
}

Comentarios

Mostrar el control es equivalente a establecer la Visible propiedad trueen . Después de llamar al Show método , la Visible propiedad devuelve un valor de true hasta que se llama al Hide método .

Se aplica a

Producto Versiones
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7

Consulte también