Control.Visibleとは? わかりやすく解説

Control.Visible プロパティ

サーバー コントロールを UI としてページに表示するかどうかを示す値を取得または設定します。

名前空間: System.Web.UI
アセンブリ: System.Web (system.web.dll 内)
構文構文

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Control.Visible プロパティ

コントロールが表示されているかどうかを示す値を取得または設定します。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

<LocalizableAttribute(True)> _
Public Property Visible As
 Boolean
Dim instance As Control
Dim value As Boolean

value = instance.Visible

instance.Visible = value
[LocalizableAttribute(true)] 
public bool Visible { get;
 set; }
[LocalizableAttribute(true)] 
public:
property bool Visible {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_Visible ()

/** @property */
public void set_Visible (boolean value)

プロパティ値
コントロールが表示されている場合は true。それ以外の場合は false。既定値は true です。

使用例使用例

派生クラス VScrollBar および HScrollBar を使用し、PictureBox コントロール内に表示されている Image のサイズに基づいて Visible プロパティ値を設定するコード例を次に示します。この例では、フォーム上に PictureBox が作成されており、PictureBox 上に HScrollBar コントロールおよび VScrollBar コントロールが作成されていることが必要です。このコードは、イメージがピクチャ ボックスに読み込まれたときに、フォームの Resize イベントによって呼び出されます。

Public Sub DisplayScrollBars()
    ' Display or hide the scroll bars based upon  
    ' whether the image is larger than the PictureBox.
    If pictureBox1.Width > pictureBox1.Image.Width Then
        hScrollBar1.Visible = False
    Else
        hScrollBar1.Visible = True
    End If
    
    If pictureBox1.Height > pictureBox1.Image.Height Then
        vScrollBar1.Visible = False
    Else
        vScrollBar1.Visible = True
    End If
End Sub 'DisplayScrollBars
public void DisplayScrollBars()
 {
    // Display or hide the scroll bars based upon  
    // whether the image is larger than the PictureBox.
    if (pictureBox1.Width > pictureBox1.Image.Width)
    {
       hScrollBar1.Visible = false;
    }
    else
    {
       hScrollBar1.Visible = true;
    }
    
    if (pictureBox1.Height > pictureBox1.Image.Height)
    {
       vScrollBar1.Visible = false;
    }
    else
    {
       vScrollBar1.Visible = true;
    }
 }
 
public:
   void DisplayScrollBars()
   {
      // Display or hide the scroll bars based upon  
      // whether the image is larger than the PictureBox.
      if ( pictureBox1->Width > pictureBox1->Image->Width
 )
      {
         hScrollBar1->Visible = false;
      }
      else
      {
         hScrollBar1->Visible = true;
      }

      if ( pictureBox1->Height > pictureBox1->Image->Height
 )
      {
         vScrollBar1->Visible = false;
      }
      else
      {
         vScrollBar1->Visible = true;
      }
   }
public void DisplayScrollBars()
{
    // Display or hide the scroll bars based upon  
    // whether the image is larger than the PictureBox.
    if (pictureBox1.get_Width() > pictureBox1.get_Image().get_Width())
 {
        hScrollBar1.set_Visible(false);
    }
    else {
        hScrollBar1.set_Visible(true);
    }

    if (pictureBox1.get_Height() > pictureBox1.get_Image().get_Height())
 {
        vScrollBar1.set_Visible(false);
    }
    else {
        vScrollBar1.set_Visible(true);
    }
} //DisplayScrollBars
public function DisplayScrollBars()
 {
    // Display or hide the scroll bars based upon  
    // whether the image is larger than the PictureBox.
    if (pictureBox1.Width > pictureBox1.Image.Width)
    {
       hScrollBar1.Visible = false;
    }
    else
    {
       hScrollBar1.Visible = true;
    }
    
    if (pictureBox1.Height > pictureBox1.Image.Height)
    {
       vScrollBar1.Visible = false;
    }
    else
    {
       vScrollBar1.Visible = true;
    }
 }
 
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「Control.Visible」の関連用語

Control.Visibleのお隣キーワード

   

英語⇒日本語
日本語⇒英語
   



Control.Visibleのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS