Freigeben über


Control.Show-Methode

Zeigt dem Benutzer das Steuerelement an.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Sub Show
'Usage
Dim instance As Control

instance.Show
public void Show ()
public:
void Show ()
public void Show ()
public function Show ()

Hinweise

Das Anzeigen des Steuerelements entspricht dem Festlegen der Visible-Eigenschaft auf true. Nach dem Aufrufen der Show-Methode gibt die Visible-Eigenschaft den Wert true zurück, bis die Hide-Methode aufgerufen wird.

Beispiel

Im folgenden Codebeispiel wird ein Dialogfeld Info angezeigt und vorübergehend ein blaues Quadrat auf der Oberfläche des Felds gezeichnet. Für dieses Beispiel muss eine von Form abgeleitete Klasse mit dem Namen AboutDialog definiert sein.

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
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:
   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.get_Blue(), 10, 10, 50, 50);
} //menuItemHelpAbout_Click

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

Control-Klasse
Control-Member
System.Windows.Forms-Namespace
Visible
Hide