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

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

ScrollableControl.AutoScrollMargin プロパティ

自動スクロールマージンサイズ取得または設定します

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

<LocalizableAttribute(True)> _
Public Property AutoScrollMargin As
 Size
Dim instance As ScrollableControl
Dim value As Size

value = instance.AutoScrollMargin

instance.AutoScrollMargin = value
[LocalizableAttribute(true)] 
public Size AutoScrollMargin { get; set;
 }
[LocalizableAttribute(true)] 
public:
property Size AutoScrollMargin {
    Size get ();
    void set (Size value);
}
/** @property */
public Size get_AutoScrollMargin ()

/** @property */
public void set_AutoScrollMargin (Size value)
public function get AutoScrollMargin
 () : Size

public function set AutoScrollMargin
 (value : Size)

プロパティ
自動スクロールマージンの高さと幅をピクセル単位で表す Size

例外例外
例外種類条件

ArgumentOutOfRangeException

代入されHeight または Width の値が 0 未満です。

解説解説

自動スクロールマージンは、子コントロールかスクロール可能なコントロールの端までの距離です。AutoScrollMargin サイズは、スクロール バーが必要かどうか判断するスクロール可能なコントロール格納された、すべてのコントロールサイズ追加されます。AutoScrollMargin プロパティは、スクロール可能なコントロールサイズ変更されるか、または個別の子コントロールビュー表示されたときに評価されスクロール バー表示する必要の有無判断するために使用されます。ドッキングされたコントロールは、スクロール バー表示する必要の有無判断する計算から除外されます。

メモメモ

ドッキングされたコントロールDock プロパティが DockStyle.Fill に設定されている場合は、コントロールスクロール可能なコントロール表示されスクロール バーが必要かどうか判断する AutoScrollMargin使用した場合は、ドッキングされたコントロール無視されます。

コントロール端からスクロール可能なコントロールまでの距離が AutoScrollMargin プロパティ割り当てられた値未満であり、AutoScroll プロパティtrue設定されている場合該当するスクロール バー表示されます。

使用例使用例

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

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

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);
       }
    }
 }
 
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 );
      }
   }
}
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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ScrollableControl クラス
ScrollableControl メンバ
System.Windows.Forms 名前空間
ScrollableControl.AutoScroll プロパティ
SetAutoScrollMargin
AutoScrollPosition
AutoScrollMinSize
DisplayRectangle



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ScrollableControl.AutoScrollMargin プロパティ」の関連用語

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

   

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



ScrollableControl.AutoScrollMargin プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS