Aktualisiert: November 2007
Zeigt dem Benutzer das Steuerelement an.
Namespace:
System.Windows.Forms
Assembly:
System.Windows.Forms (in System.Windows.Forms.dll)
Visual Basic (Deklaration)
Visual Basic (Verwendung)
Dim instance As Control
instance.Show()
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.
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
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile für Smartphone, Windows Mobile für Pocket PC
.NET Framework und .NET Compact Framework unterstützen nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.
.NET Framework
Unterstützt in: 3.5, 3.0, 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 3.5, 2.0, 1.0
Referenz