クリックして評価とフィードバックをお寄せください
MSDN
MSDN ライブラリ
.NET 開発
以前のバージョン
.NET Framework SDK 2.0
System.Windows.Forms
ScrollableControl クラス
ScrollableControl プロパティ
 AutoScroll プロパティ

  低帯域幅での表示をオンにする
このページは次のバージョンについて記述しています。
Microsoft Visual Studio 2005/.NET Framework 2.0

その他のバージョンについては、以下の情報を参照してください。
.NET Framework クラス ライブラリ
ScrollableControl.AutoScroll プロパティ

コンテナで、表示されている境界の外にあるコントロールにユーザーがスクロールできるかどうかを示す値を取得または設定します。

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

Visual Basic (宣言)
<LocalizableAttribute(True)> _
Public Overridable Property AutoScroll As Boolean
Visual Basic (使用法)
Dim instance As ScrollableControl
Dim value As Boolean

value = instance.AutoScroll

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

/** @property */
public void set_AutoScroll (boolean value)
JScript
public function get AutoScroll () : boolean

public function set AutoScroll (value : boolean)

プロパティ値

コンテナで自動スクロールが実行できる場合は true。それ以外の場合は false。既定値は false です。

このプロパティが true の場合、コンテナには、表示されている境界よりも大きい仮想サイズを設定できます。

派生クラス Panel を使用するコード例を次に示します。この例では、テキスト ボックスの位置を評価し、その親コンテナであるパネル コントロールの外観と動作を変更します。この例は、Panel コントロール、TextBox、および Button のインスタンスが作成されていることを前提に記述されています。テキスト ボックスをパネルに配置する場合は、少なくとも 1 つのパネルの端と重なるようにします。ボタンがクリックされたときにこの Sub プロシージャを呼び出して、パネルの動作と外観の違いを確認します。

Visual Basic
Private Sub SetAutoScrollMargins()
    ' If the text box is outside the panel's bounds,
    ' turn on auto-scrolling and set the margin. 
    If (text1.Location.X > panel1.Location.X) Or _
        (text1.Location.Y > panel1.Location.Y) Then
        panel1.AutoScroll = True
        ' If the AutoScrollMargin is set to less
        ' than (5,5), set it to 5,5. 
        If (panel1.AutoScrollMargin.Width < 5) Or _
            (panel1.AutoScrollMargin.Height < 5) Then
            
            panel1.SetAutoScrollMargin(5, 5)
        End If
    End If
End Sub

C#
private void SetAutoScrollMargins()
 {
    /* If the text box is outside the panel's bounds, 
       turn on auto-scrolling and set the margin. */  
    if (text1.Location.X > panel1.Location.X || 
       text1.Location.Y > panel1.Location.Y)
    {
       panel1.AutoScroll = true;
       /* If the AutoScrollMargin is set to less 
          than (5,5), set it to 5,5. */
       if( panel1.AutoScrollMargin.Width < 5 || 
          panel1.AutoScrollMargin.Height < 5)
       {
          panel1.SetAutoScrollMargin(5, 5);
       }
    }
 }
 
C++
void SetAutoScrollMargins()
{
   /* If the text box is outside the panel's bounds, 
          turn on auto-scrolling and set the margin. */
   if ( text1->Location.X > panel1->Location.X || text1->Location.Y > panel1->Location.Y )
   {
      panel1->AutoScroll = true;

      /* If the AutoScrollMargin is set to less 
                than (5,5), set it to 5,5. */
      if ( panel1->AutoScrollMargin.Width < 5 || panel1->AutoScrollMargin.Height < 5 )
      {
         panel1->SetAutoScrollMargin( 5, 5 );
      }
   }
}
J#
private void SetAutoScrollMargins()
{
    /* If the text box is outside the panel's bounds, 
       turn on auto-scrolling and set the margin. */
    if (text1.get_Location().get_X() > panel1.get_Location().get_X() 
        || text1.get_Location().get_Y() > panel1.get_Location().get_Y()) {
        
        panel1.set_AutoScroll(true);

        /* If the AutoScrollMargin is set to less 
           than (5,5), set it to 5,5. */
        if (panel1.get_AutoScrollMargin().get_Width() < 5 
            || panel1.get_AutoScrollMargin().get_Height() < 5) {
                panel1.SetAutoScrollMargin(5, 5);
        }
    }
} //SetAutoScrollMargins

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
コミュニティ コンテンツ   コミュニティ コンテンツとは
新しいコンテンツの追加 RSS  注釈
Processing
© 2009 Microsoft Corporation. All rights reserved. 使用条件  |  商標  |  プライバシー
Page view tracker