Control.Show Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Mostra o controlo ao utilizador.
public:
void Show();
public void Show();
member this.Show : unit -> unit
Public Sub Show ()
Exemplos
O exemplo de código seguinte mostra uma caixa de diálogo sobre e desenha temporariamente um quadrado azul na sua superfície. Este exemplo exige que tenhas definido uma classe que deriva de Form nomeada 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
Observações
Mostrar o controlo é equivalente a definir a Visible propriedade para true. Depois de o Show método ser chamado, a Visible propriedade devolve um valor de true até que o Hide método seja chamado.