Form.AutoScroll プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Form.AutoScroll プロパティの意味・解説 

Form.AutoScroll プロパティ

フォームで自動スクロールを有効にするかどうかを示す値を取得または設定します。

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

<LocalizableAttribute(True)> _
Public Overrides Property
 AutoScroll As Boolean
Dim instance As Form
Dim value As Boolean

value = instance.AutoScroll

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

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

プロパティ値
フォームで自動スクロールを有効にする場合は true。それ以外の場合は false。既定値は false です。

解説解説
使用例使用例

AutoScroll プロパティを使用して、フォームのクライアント領域より大きいコントロールの表示を有効にする方法を次のコード例に示します。この例では、新しいフォームを作成し、そのフォームに Button コントロールを追加します。この Button コントロールのサイズは、作成した新しいフォームのクライアント領域より大きくなっています。ユーザーがコントロールでスクロールを行えるように、AutoScroll プロパティを true に設定して、フォーム上にスクロール バーを表示します。この例は、この例で定義されているメソッドが別のフォームからイベント ハンドラか他のメソッドで呼び出されることを前提にしています。

Private Sub DisplayMyScrollableForm()
   ' Create a new form.
   Dim form2 As New Form()
   ' Create a button to add to the new form.
   Dim button1 As New Button()
   ' Set text for the button.
   button1.Text = "Scrolled Button"
   ' Set the size of the button.
   button1.Size = New Size(100, 30)
   ' Set the location of the button to be outside the form's client
 area.
   button1.Location = New Point(form2.Size.Width + 200, form2.Size.Height
 + 200)

   ' Add the button control to the new form.
   form2.Controls.Add(button1)
   ' Set the AutoScroll property to true to provide scrollbars.
   form2.AutoScroll = True

   ' Display the new form as a dialog box.
   form2.ShowDialog()
End Sub
private void DisplayMyScrollableForm()
{
   // Create a new form.
   Form form2 = new Form();
   // Create a button to add to the new form.
   Button button1 = new Button();
   // Set text for the button.
   button1.Text = "Scrolled Button";
   // Set the size of the button.
   button1.Size = new Size(100,30);
   // Set the location of the button to be outside the form's client
 area.
   button1.Location = new Point(form2.Size.Width + 200, form2.Size.Height
 + 200);

   // Add the button control to the new form.
   form2.Controls.Add(button1);
   // Set the AutoScroll property to true to provide scrollbars.
   form2.AutoScroll = true;

   // Display the new form as a dialog box.
   form2.ShowDialog();
}
private:
   void DisplayMyScrollableForm()
   {
      // Create a new form.
      Form^ form2 = gcnew Form;

      // Create a button to add to the new form.
      Button^ button1 = gcnew Button;

      // Set text for the button.
      button1->Text = "Scrolled Button";

      // Set the size of the button.
      button1->Size = System::Drawing::Size( 100, 30 );

      // Set the location of the button to be outside the form's client
 area.
      button1->Location = Point(form2->Size.Width + 200,form2->Size.Height
 + 200);

      // Add the button control to the new form.
      form2->Controls->Add( button1 );

      // Set the AutoScroll property to true to provide scrollbars.
      form2->AutoScroll = true;

      // Display the new form as a dialog box.
      form2->ShowDialog();
   }
private void DisplayMyScrollableForm()
{
    // Create a new form.
    Form form2 = new Form();

    // Create a button to add to the new form.
    Button button1 = new Button();

    // Set text for the button.
    button1.set_Text("Scrolled Button");

    // Set the size of the button.
    button1.set_Size(new Size(100, 30));

    // Set the location of the button to be outside the form's client
 area.
    button1.set_Location(new Point(form2.get_Size().get_Width()
 + 200, 
        form2.get_Size().get_Height() + 200));

    // Add the button control to the new form.
    form2.get_Controls().Add(button1);

    // Set the AutoScroll property to true to provide scrollbars.
    form2.set_AutoScroll(true);

    // Display the new form as a dialog box.
    form2.ShowDialog();       
} //DisplayMyScrollableForm  
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「Form.AutoScroll プロパティ」の関連用語

Form.AutoScroll プロパティのお隣キーワード
検索ランキング

   

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



Form.AutoScroll プロパティのページの著作権

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

©2026 GRAS Group, Inc.RSS