다음을 통해 공유


Control.Show 메서드

컨트롤을 사용자에게 표시합니다.

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
Public Sub Show
‘사용 방법
Dim instance As Control

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

설명

컨트롤을 표시하려면 Visible 속성을 true로 설정합니다. Show 메서드를 호출하면 Hide 메서드를 호출할 때까지 Visible 속성은 true 값을 반환합니다.

예제

다음 코드 예제에서는 정보 대화 상자를 표시하고 일시적으로 화면에 파란색 정사각형을 그립니다. 이 예제를 실행하려면 AboutDialog라는 Form에서 파생된 클래스가 정의되어 있어야 합니다.

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 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

Control 클래스
Control 멤버
System.Windows.Forms 네임스페이스
Visible
Hide