Control.Show Method
Displays the control to the user.
[Visual Basic] Public Sub Show() [C#] public void Show(); [C++] public: void Show(); [JScript] public function Show();
Remarks
Showing the control is equivalent to setting the Visible property to true. After the Show method is called, the Visible property returns a value of true until the Hide method is called.
Example
[Visual Basic, C#, C++] The following example displays an about dialog box and temporarily draws a blue square on it's surface. This example assumes you have defined a class that derives from Form named AboutDialog.
[Visual Basic] 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 [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); } [C++] private: void menuItemHelpAbout_Click(Object* /*sender*/, EventArgs* /*e*/) { // Create and display a modeless 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); }
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
See Also
Control Class | Control Members | System.Windows.Forms Namespace | Visible | Hide