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

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

ScrollBar.Maximum プロパティ

スクロール可能な範囲の上限値を取得または設定します

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

解説解説
使用例使用例

派生クラス VScrollBar と HScrollBar を使用して、これらのクラスの共通プロパティ一部設定するコード例次に示します。これらの Maximum プロパティは、親である PictureBox に割り当てられている Image の高さおよび幅と等しくなるように設定されます。LargeChange プロパティは、ピクチャ ボックスサイズからスクロール バーの高さまたは幅を引いたサイズ設定されます。SmallChange プロパティは、LargeChange プロパティの値を 5 で割った値に設定されます。最後に両方スクロール バーValue プロパティの値が 0 に設定されます。この結果Image左上隅を表示するピクチャ ボックスに、垂直スクロール バースクロール バー表示されます。スクロール バーは、イメージ範囲越えてスクロールすることはありません。LargeChange実行され場合イメージは、ピクチャ ボックス表示され領域と同じ距離だけ移動します。5 回の SmallChange スクロールで、1 回LargeChange スクロールと同じ距離だけ移動します。このコードは、PictureBoxHScrollBarVScrollBar、および ImageForm 上ですべて作成されていることを前提にしています。この例は、System.Drawing 名前空間への参照追加されていることも前提にしています。この例を拡張するための追加コードについては、ScrollBar クラス概要トピック参照してください

Public Sub SetScrollBarValues()
   ' Set the Maximum, Minimum, LargeChange and SmallChange properties.
   Me.vScrollBar1.Minimum = 0
   Me.hScrollBar1.Minimum = 0
   
   ' If the offset does not make the Maximum less than zero, set its
 value.
   If Me.pictureBox1.Image.Size.Width - pictureBox1.ClientSize.Width
 > 0 Then
      Me.hScrollBar1.Maximum = Me.pictureBox1.Image.Size.Width
 - _
        pictureBox1.ClientSize.Width
   End If
   ' If the VScrollBar is visible, adjust the Maximum of the 
   ' HSCrollBar to account for the width of the VScrollBar.
   If Me.vScrollBar1.Visible Then
      Me.hScrollBar1.Maximum += Me.vScrollBar1.Width
   End If
   Me.hScrollBar1.LargeChange = Me.hScrollBar1.Maximum
 / 10
   Me.hScrollBar1.SmallChange = Me.hScrollBar1.Maximum
 / 20
   ' Adjust the Maximum value to make the raw Maximum value attainable
 by user interaction.
   Me.hScrollBar1.Maximum += Me.hScrollBar1.LargeChange
         
   ' If the offset does not make the Maximum less than zero, set its
 value.
   If Me.pictureBox1.Image.Size.Height - pictureBox1.ClientSize.Height
 > 0 Then
      Me.vScrollBar1.Maximum = Me.pictureBox1.Image.Size.Height
 - _
        pictureBox1.ClientSize.Height
   End If
   ' If the HScrollBar is visible, adjust the Maximum of the 
   ' VSCrollBar to account for the width of the HScrollBar.
   If Me.hScrollBar1.Visible Then
      Me.vScrollBar1.Maximum += Me.hScrollBar1.Height
   End If
   Me.vScrollBar1.LargeChange = Me.vScrollBar1.Maximum
 / 10
   Me.vScrollBar1.SmallChange = Me.vScrollBar1.Maximum
 / 20
   ' Adjust the Maximum value to make the raw Maximum value attainable
 by user interaction.
   Me.vScrollBar1.Maximum += Me.vScrollBar1.LargeChange
End Sub
public void SetScrollBarValues() 
{
   // Set the Maximum, Minimum, LargeChange and SmallChange properties.
   this.vScrollBar1.Minimum = 0;
   this.hScrollBar1.Minimum = 0;
   // If the offset does not make the Maximum less than zero, set its
 value. 
   if( (this.pictureBox1.Image.Size.Width -
 pictureBox1.ClientSize.Width) > 0)
   {
      this.hScrollBar1.Maximum = this.pictureBox1.Image.Size.Width
 - pictureBox1.ClientSize.Width;
   }
   /* If the VScrollBar is visible, adjust the Maximum of the 
      HSCrollBar to account for the width of the VScrollBar. */
   if(this.vScrollBar1.Visible)
   {
      this.hScrollBar1.Maximum += this.vScrollBar1.Width;
   }
   this.hScrollBar1.LargeChange = this.hScrollBar1.Maximum
 / 10;
   this.hScrollBar1.SmallChange = this.hScrollBar1.Maximum
 / 20;
   // Adjust the Maximum value to make the raw Maximum value attainable
 by user interaction.
   this.hScrollBar1.Maximum += this.hScrollBar1.LargeChange;
     
   // If the offset does not make the Maximum less than zero, set its
 value.    
   if( (this.pictureBox1.Image.Size.Height
 - pictureBox1.ClientSize.Height) > 0)
   {
      this.vScrollBar1.Maximum = this.pictureBox1.Image.Size.Height
 - pictureBox1.ClientSize.Height;
   }
   /* If the HScrollBar is visible, adjust the Maximum of the 
      VSCrollBar to account for the width of the HScrollBar.*/
   if(this.hScrollBar1.Visible)
   {
      this.vScrollBar1.Maximum += this.hScrollBar1.Height;
   }
   this.vScrollBar1.LargeChange = this.vScrollBar1.Maximum
 / 10;
   this.vScrollBar1.SmallChange = this.vScrollBar1.Maximum
 / 20;
   // Adjust the Maximum value to make the raw Maximum value attainable
 by user interaction.
   this.vScrollBar1.Maximum += this.vScrollBar1.LargeChange;
}
void SetScrollBarValues()
{
   // Set the Maximum, Minimum, LargeChange and SmallChange properties.
   this->vScrollBar1->Minimum = 0;
   this->hScrollBar1->Minimum = 0;

   // If the offset does not make the Maximum less than zero, set its
 value. 
   if ( (this->pictureBox1->Image->Size.Width
 - pictureBox1->ClientSize.Width) > 0 )
   {
      this->hScrollBar1->Maximum = this->pictureBox1->Image->Size.Width
 - pictureBox1->ClientSize.Width;
   }

   /* If the VScrollBar is visible, adjust the Maximum of the 
         HSCrollBar to account for the width of the VScrollBar.
 */
   if ( this->vScrollBar1->Visible )
   {
      this->hScrollBar1->Maximum += this->vScrollBar1->Width;
   }

   this->hScrollBar1->LargeChange = this->hScrollBar1->Maximum
 / 10;
   this->hScrollBar1->SmallChange = this->hScrollBar1->Maximum
 / 20;

   // Adjust the Maximum value to make the raw Maximum value attainable
 by user interaction.
   this->hScrollBar1->Maximum += this->hScrollBar1->LargeChange;

   // If the offset does not make the Maximum less than zero, set its
 value.    
   if ( (this->pictureBox1->Image->Size.Height
 - pictureBox1->ClientSize.Height) > 0 )
   {
      this->vScrollBar1->Maximum = this->pictureBox1->Image->Size.Height
 - pictureBox1->ClientSize.Height;
   }

   /* If the HScrollBar is visible, adjust the Maximum of the 
         VSCrollBar to account for the width of the HScrollBar.*/
   if ( this->hScrollBar1->Visible )
   {
      this->vScrollBar1->Maximum += this->hScrollBar1->Height;
   }

   this->vScrollBar1->LargeChange = this->vScrollBar1->Maximum
 / 10;
   this->vScrollBar1->SmallChange = this->vScrollBar1->Maximum
 / 20;
   
   // Adjust the Maximum value to make the raw Maximum value attainable
 by user interaction.
   this->vScrollBar1->Maximum += this->vScrollBar1->LargeChange;
}
public void SetScrollBarValues()
{
    // Set the Maximum, Minimum, LargeChange and SmallChange properties.
    this.vScrollBar1.set_Minimum(0);
    this.hScrollBar1.set_Minimum(0);

    // If the offset does not make the Maximum less than zero, 
    // set its value. 
    if (this.pictureBox1.get_Image().get_Size().get_Width()
 
        - pictureBox1.get_ClientSize().get_Width() > 0) {
            this.hScrollBar1.set_Maximum(
                this.pictureBox1.get_Image().get_Size().get_Width()
 
                - pictureBox1.get_ClientSize().get_Width());
    }

    /* If the VScrollBar is visible, adjust the Maximum of the 
       HSCrollBar to account for the width of the VScrollBar.
 
     */
    if (this.vScrollBar1.get_Visible()) {
        this.hScrollBar1.set_Maximum(
            this.hScrollBar1.get_Maximum() + this.vScrollBar1.get_Width());
    }

    this.hScrollBar1.set_LargeChange(this.hScrollBar1.get_Maximum()
 / 10);
    this.hScrollBar1.set_SmallChange(this.hScrollBar1.get_Maximum()
 / 20);

    // Adjust the Maximum value to make the raw Maximum value attainable
 
    // by user interaction.
    this.hScrollBar1.set_Maximum(
        this.hScrollBar1.get_Maximum() 
        + this.hScrollBar1.get_LargeChange());

    // If the offset does not make the Maximum less than zero, 
    // set its value.    
    if (this.pictureBox1.get_Image().get_Size().get_Height()
 
        - pictureBox1.get_ClientSize().get_Height() > 0) {
            this.vScrollBar1.set_Maximum(
                this.pictureBox1.get_Image().get_Size().get_Height()
 
                - pictureBox1.get_ClientSize().get_Height());
    }

    /* If the HScrollBar is visible, adjust the Maximum of the 
       VSCrollBar to account for the width of the HScrollBar.
     */
    if (this.hScrollBar1.get_Visible()) {
        this.vScrollBar1.set_Maximum(this.vScrollBar1.get_Maximum()
 
            + this.hScrollBar1.get_Height());
    }

    this.vScrollBar1.set_LargeChange(this.vScrollBar1.get_Maximum()
 / 10);
    this.vScrollBar1.set_SmallChange(this.vScrollBar1.get_Maximum()
 / 20);

    // Adjust the Maximum value to make the raw Maximum value attainable
 
    // by user interaction.
    this.vScrollBar1.set_Maximum(
        this.vScrollBar1.get_Maximum() 
        + this.vScrollBar1.get_LargeChange());
} //SetScrollBarValues
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「ScrollBar.Maximum プロパティ」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS