ScrollBarsとは? わかりやすく解説

ScrollBars 列挙体

メモ : この列挙体は、.NET Framework version 2.0新しく追加されたものです。

Panel コントロールスクロール バー表示態と位置指定します

この列挙体には、メンバ値のビットごとの組み合わせ可能にする FlagsAttribute 属性含まれています。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

<FlagsAttribute> _
Public Enumeration ScrollBars
[FlagsAttribute] 
public enum ScrollBars
[FlagsAttribute] 
public enum class ScrollBars
/** @attribute FlagsAttribute() */ 
public enum ScrollBars
FlagsAttribute 
public enum ScrollBars
メンバメンバ
解説解説
使用例使用例

ScrollBars プロパティ宣言によって Auto設定する方法コード例次に示しますパネルに表があり、その内容全体パネルサイズ超えてます。この場合パネル描画すると、垂直スクロール バースクロール バー両方自動的に表示されます。ユーザースクロールして、表内のすべてのデータ表示できます

<%@ Page Language="VB" %>

<html>
<head>
    <script runat="server">
        Private Sub Page_Load(ByVal
 sender As Object, ByVal
 e As System.EventArgs)
                
            ' Add more rows and columns to the table than can
            ' be displayed in the panel area.
            ' Scroll bars will be required to view all the data.
           
            ' Add rows and columns to the table.
            Dim i As Integer
            For i = 0 To 50
                Dim tempRow As New
 TableRow
                Dim j As Integer
                For j = 0 To 10
                    Dim tempCell As New
 TableCell
                    tempCell.Text = "(" & i &
 "," & j & ")"
                    tempRow.Cells.Add(tempCell)
                Next j
                Table1.Rows.Add(tempRow)
            Next i
                 
        End Sub

    </script>
</head>
<body>

    <form ID="Form1" runat="server">
        
        <h3>Panel.ScrollBars Property Example</h3>
        
                
        <asp:Panel ID="Panel1"
            Height="300px"
            Width="400px"
            BackColor=Aqua
            ScrollBars=Auto
            runat=Server>
        
            <asp:Table ID="Table1"
                runat=Server>             
            </asp:Table>  
        
        </asp:Panel>         
         
    </form>
</body>
</html>

ScrollBars 列挙値を次のコード例示しますListBox コントロールには、ScrollBars 列挙値が設定されます。パネル表示されるスクロール バーは、ユーザーリスト ボックスから選択する値に基づいて変わります

<%@ Page Language="VB" %>

<html>
<head>
    <script runat="server">
        Private Sub Page_Load(ByVal
 sender As Object, ByVal
 e As System.EventArgs)
                
            ' Add more rows and columns to the table than can
            ' be displayed in the panel area.
            ' Scroll bars will be required to view all the data.
           
            ' Add rows and columns to the table.
            Dim i As Integer
            For i = 0 To 50
                Dim tempRow As New
 TableRow
                Dim j As Integer
                For j = 0 To 10
                    Dim tempCell As New
 TableCell
                    tempCell.Text = "(" & i &
 "," & j & ")"
                    tempRow.Cells.Add(tempCell)
                Next j
                Table1.Rows.Add(tempRow)
            Next i
                 
        End Sub
   
        Sub ListBox1_SelectedIndexChanged(ByVal
 sender As Object, ByVal
 e As EventArgs)

            ' Determine which list item was clicked.
            ' Display the selected scroll bars in the panel.
            Select Case (ListBox1.SelectedIndex)
                Case 0
                    Panel1.ScrollBars = ScrollBars.None
                Case 1
                    Panel1.ScrollBars = ScrollBars.Horizontal
                Case 2
                    Panel1.ScrollBars = ScrollBars.Vertical
                Case 3
                    Panel1.ScrollBars = ScrollBars.Both
                Case 4
                    Panel1.ScrollBars = ScrollBars.Auto
                Case Else
                    Throw New Exception("You
 did not select a valid list item.")
            End Select

        End Sub
     
    </script>
</head>
<body>
    <form ID="Form1" runat="server">
        
        <h3>Panel.ScrollBars Property Example</h3>
        
        <h4>Select the scrollbars to display in
 the panel.</h4>
        
        <asp:ListBox ID="ListBox1"
            Rows=5
            AutoPostBack=True
            SelectionMode=Single
            OnSelectedIndexChanged="ListBox1_SelectedIndexChanged"
            runat=Server>
                <asp:ListItem>None</asp:ListItem>
            <asp:ListItem>Horizontal</asp:ListItem> 
            <asp:ListItem>Vertical</asp:ListItem>
        <asp:ListItem>Both</asp:ListItem> 
        <asp:ListItem>Auto</asp:ListItem>              
        </asp:ListBox>
            
        <hr />              
        
        <asp:Panel ID="Panel1"
            Height="300px"
            Width="400px"
            BackColor=Aqua           
            runat=Server>            
            
            <asp:Table ID="Table1"
                runat=Server>             
            </asp:Table>
               
        </asp:Panel>           
         
    </form>
</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
System.Web.UI.WebControls 名前空間
Panel.ScrollBars プロパティ

ScrollBars 列挙体

コントロール表示するスクロール バー指定します

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

public enum ScrollBars
public enum class ScrollBars
public enum ScrollBars
public enum ScrollBars
メンバメンバ
解説解説
使用例使用例

ScrollBars 列挙体を使用する方法次のコード例示します。この例を実行するには、次のコードフォーム貼り付けます。フォームコンストラクタまたは Load イベント処理メソッドSetFourDifferentScrollBars メソッド呼び出します。

' Declare four textboxes.
Friend WithEvents vertical As
 System.Windows.Forms.TextBox
Friend WithEvents horizontal As
 System.Windows.Forms.TextBox
Friend WithEvents both As
 System.Windows.Forms.TextBox
Friend WithEvents none As
 System.Windows.Forms.TextBox
    
Private Sub SetFourDifferentScrollBars()

    Me.vertical = New System.Windows.Forms.TextBox
    Me.horizontal = New System.Windows.Forms.TextBox
    Me.both = New System.Windows.Forms.TextBox
    Me.none = New System.Windows.Forms.TextBox

    ' Create a string for the Text property.
    Dim startString As String
 = _
        "The scroll bar style for my textbox is: "

    ' Set the location of the four textboxes.
    horizontal.Location = New Point(10, 10)
    vertical.Location = New Point(10, 70)
    none.Location = New Point(10, 170)
    both.Location = New Point(10, 110)

    ' For horizonal scroll bars, the Multiline property must
    ' be true and the WordWrap property must be false.
    ' Increase the size of the Height property to ensure the 
    ' scroll bar is visible.
    horizontal.ScrollBars = ScrollBars.Horizontal
    horizontal.Multiline = True
    horizontal.WordWrap = False
    horizontal.Height = 40
    horizontal.Text = startString & ScrollBars.Horizontal.ToString()

    ' For the vertical scroll bar, Multiline must be true.
    vertical.ScrollBars = ScrollBars.Vertical
    vertical.Multiline = True
    vertical.Text = startString & ScrollBars.Vertical.ToString()

    ' For both scroll bars, the Multiline property 
    ' must be true, and the WordWrap property must be false.
    ' Increase the size of the Height property to ensure the 
    ' scroll bar is visible.
    both.ScrollBars = ScrollBars.Both
    both.Multiline = True
    both.WordWrap = False
    both.Height = 40
    both.AcceptsReturn = True
    both.Text = startString & ScrollBars.Both.ToString()

    ' The none scroll bar does not require specific 
    ' property settings.
    none.ScrollBars = ScrollBars.None
    none.Text = startString & ScrollBars.None.ToString()

    ' Add the textboxes to the form.
    Me.Controls.Add(Me.vertical)
    Me.Controls.Add(Me.horizontal)
    Me.Controls.Add(Me.both)
    Me.Controls.Add(Me.none)

End Sub
// Declare four textboxes.
internal System.Windows.Forms.TextBox vertical;
internal System.Windows.Forms.TextBox horizontal;
internal System.Windows.Forms.TextBox both;
internal System.Windows.Forms.TextBox none;

private void SetFourDifferentScrollBars()
{
    
    this.vertical = new System.Windows.Forms.TextBox();
    this.horizontal = new System.Windows.Forms.TextBox();
    this.both = new System.Windows.Forms.TextBox();
    this.none = new System.Windows.Forms.TextBox();

    // Create a string for the Text property.
    string startString = "The scroll bar style for
 my textbox is: ";

    // Set the location of the four textboxes.
    horizontal.Location = new Point(10, 10);
    vertical.Location = new Point(10, 70);
    none.Location = new Point(10, 170);
    both.Location = new Point(10, 110);

    // For horizonal scroll bars, the Multiline property must
    // be true and the WordWrap property must be false.
    // Increase the size of the Height property to ensure the 
    // scroll bar is visible.
    horizontal.ScrollBars = ScrollBars.Horizontal;
    horizontal.Multiline = true;
    horizontal.WordWrap = false;
    horizontal.Height = 40;
    horizontal.Text = startString + 
        ScrollBars.Horizontal.ToString();

    // For the vertical scroll bar, Multiline must be true.
    vertical.ScrollBars = ScrollBars.Vertical;
    vertical.Multiline = true;
    vertical.Text = startString + ScrollBars.Vertical.ToString();

    // For both scroll bars, the Multiline property 
    // must be true, and the WordWrap property must be false.
    // Increase the size of the Height property to ensure the 
    // scroll bar is visible.
    both.ScrollBars = ScrollBars.Both;
    both.Multiline = true;
    both.WordWrap = false;
    both.Height = 40;
    both.AcceptsReturn = true;
    both.Text = startString + ScrollBars.Both.ToString();

    // The none scroll bar does not require specific 
    // property settings.
    none.ScrollBars = ScrollBars.None;
    none.Text = startString + ScrollBars.None.ToString();

    // Add the textboxes to the form.
    this.Controls.Add(this.vertical);
    this.Controls.Add(this.horizontal);
    this.Controls.Add(this.both);
    this.Controls.Add(this.none);

}
   // Declare four textboxes.
internal:
   System::Windows::Forms::TextBox^ vertical;
   System::Windows::Forms::TextBox^ horizontal;
   System::Windows::Forms::TextBox^ both;
   System::Windows::Forms::TextBox^ none;

private:
   void SetFourDifferentScrollBars()
   {
      this->vertical = gcnew System::Windows::Forms::TextBox;
      this->horizontal = gcnew System::Windows::Forms::TextBox;
      this->both = gcnew System::Windows::Forms::TextBox;
      this->none = gcnew System::Windows::Forms::TextBox;
      
      // Create a string for the Text property.
      String^ startString = "The scroll bar style for my
 textbox is: ";
      
      // Set the location of the four textboxes.
      horizontal->Location = Point(10,10);
      vertical->Location = Point(10,70);
      none->Location = Point(10,170);
      both->Location = Point(10,110);
      
      // For horizonal scroll bars, the Multiline property must
      // be true and the WordWrap property must be false.
      // Increase the size of the Height property to ensure the 
      // scroll bar is visible.
      horizontal->ScrollBars = ScrollBars::Horizontal;
      horizontal->Multiline = true;
      horizontal->WordWrap = false;
      horizontal->Height = 40;
      horizontal->Text = String::Concat( startString, ScrollBars::Horizontal );
      
      // For the vertical scroll bar, Multiline must be true.
      vertical->ScrollBars = ScrollBars::Vertical;
      vertical->Multiline = true;
      vertical->Text = String::Concat( startString, ScrollBars::Vertical );
      
      // For both scroll bars, the Multiline property 
      // must be true, and the WordWrap property must be false.
      // Increase the size of the Height property to ensure the 
      // scroll bar is visible.
      both->ScrollBars = ScrollBars::Both;
      both->Multiline = true;
      both->WordWrap = false;
      both->Height = 40;
      both->AcceptsReturn = true;
      both->Text = String::Concat( startString, ScrollBars::Both );
      
      // The none scroll bar does not require specific 
      // property settings.
      none->ScrollBars = ScrollBars::None;
      none->Text = String::Concat( startString, ScrollBars::None );
      
      // Add the textboxes to the form.
      this->Controls->Add( this->vertical
 );
      this->Controls->Add( this->horizontal
 );
      this->Controls->Add( this->both
 );
      this->Controls->Add( this->none
 );
   }
// Declare four textboxes.
System.Windows.Forms.TextBox vertical;
System.Windows.Forms.TextBox horizontal;
System.Windows.Forms.TextBox both;
System.Windows.Forms.TextBox none;

private void SetFourDifferentScrollBars()
{
    this.vertical = new System.Windows.Forms.TextBox();
    this.horizontal = new System.Windows.Forms.TextBox();
    this.both = new System.Windows.Forms.TextBox();
    this.none = new System.Windows.Forms.TextBox();
    // Create a string for the Text property.
    String startString = "The scroll bar style for my textbox
 is: ";
    // Set the location of the four textboxes.
    horizontal.set_Location(new Point(10, 10));
    vertical.set_Location(new Point(10, 70));
    none.set_Location(new Point(10, 170));
    both.set_Location(new Point(10, 110));
    // For horizonal scroll bars, the Multiline property must
    // be true and the WordWrap property must be false.
    // Increase the size of the Height property to ensure the 
    // scroll bar is visible.
    horizontal.set_ScrollBars(ScrollBars.Horizontal);
    horizontal.set_Multiline(true);
    horizontal.set_WordWrap(false);
    horizontal.set_Height(40);
    horizontal.set_Text(startString + ScrollBars.Horizontal.ToString());
    // For the vertical scroll bar, Multiline must be true.
    vertical.set_ScrollBars(ScrollBars.Vertical);
    vertical.set_Multiline(true);
    vertical.set_Text(startString + ScrollBars.Vertical.ToString());
    // For both scroll bars, the Multiline property 
    // must be true, and the WordWrap property must be false.
    // Increase the size of the Height property to ensure the 
    // scroll bar is visible.
    both.set_ScrollBars(ScrollBars.Both);
    both.set_Multiline(true);
    both.set_WordWrap(false);
    both.set_Height(40);
    both.set_AcceptsReturn(true);
    both.set_Text(startString + ScrollBars.Both.ToString());
    // The none scroll bar does not require specific 
    // property settings.
    none.set_ScrollBars(ScrollBars.None);
    none.set_Text(startString + ScrollBars.None.ToString());
    // Add the textboxes to the form.
    this.get_Controls().Add(this.vertical);
    this.get_Controls().Add(this.horizontal);
    this.get_Controls().Add(this.both);
    this.get_Controls().Add(this.none);
} //SetFourDifferentScrollBars 
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からScrollBarsを検索した結果を表示しています。
Weblioに収録されているすべての辞書からScrollBarsを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からScrollBars を検索

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

辞書ショートカット

すべての辞書の索引

「ScrollBars」の関連用語

ScrollBarsのお隣キーワード
検索ランキング

   

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



ScrollBarsのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS