Form.AutoScroll プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

[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)
public override function get AutoScroll () : boolean public override function set AutoScroll (value : boolean)
フォームで自動スクロールを有効にする場合は true。それ以外の場合は false。既定値は false です。

このプロパティが true に設定された場合、フォームのクライアント領域外に配置されたコントロールがあると、スクロール バーが表示されます。また、自動スクロールが有効な場合、入力フォーカスを持つコントロールが表示されるように、フォームのクライアント領域が自動的にスクロールします。
このプロパティを使用すると、ビデオ解像度が低い値に設定されている場合でも、コントロールを表示できないという事態を避けることができます。

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

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からForm.AutoScroll プロパティを検索する場合は、下記のリンクをクリックしてください。

- Form.AutoScroll プロパティのページへのリンク