Control.Show Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Displays the control to the user.
public:
void Show();
public void Show ();
member this.Show : unit -> unit
Public Sub Show ()
Examples
The following code example displays an about dialog box and temporarily draws a blue square on its surface. This example requires that you have defined a class that derives from Form named 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
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.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기