共用方式為


PanelStyle.ScrollBars 屬性

定義

取得或設定在面板控制項中捲軸的可視性和位置。

public:
 virtual property System::Web::UI::WebControls::ScrollBars ScrollBars { System::Web::UI::WebControls::ScrollBars get(); void set(System::Web::UI::WebControls::ScrollBars value); };
public virtual System.Web.UI.WebControls.ScrollBars ScrollBars { get; set; }
member this.ScrollBars : System.Web.UI.WebControls.ScrollBars with get, set
Public Overridable Property ScrollBars As ScrollBars

屬性值

ScrollBars

其中一個 ScrollBars 值。 預設為 None

例外狀況

ScrollBars 屬性不是其中一個 ScrollBars 值。

範例

下列程式碼範例會將 ScrollBars 兩個面板控制項 Panel1Panel2 的屬性設定為 ScrollBars.Both 列舉值。 此程式碼範例是提供給 類別之較大範例的 PanelStyle 一部分。

public partial class PanelStylecs_aspx : Page
{
    void Page_Load(object sender, EventArgs e)
    {
        StateBag panelState = new StateBag();
        PanelStyle myPanelStyle = new PanelStyle(panelState);
        
        // Set the properties of the PanelStyle class.
        myPanelStyle.HorizontalAlign = HorizontalAlign.Center;
        myPanelStyle.ScrollBars = ScrollBars.Both;
        myPanelStyle.Wrap = false;
        myPanelStyle.Direction = ContentDirection.LeftToRight;
        myPanelStyle.BackImageUrl = @"~\images\picture.jpg";

        // Use the ApplyStyle method of the Panel control to apply
        // the settings from the myPanelStyle object.
        Panel1.ApplyStyle(myPanelStyle);
        Panel2.ApplyStyle(myPanelStyle); 
    }
}
Partial Class PanelStylevb_aspx
    Inherits Page

    Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

        Dim panelState As StateBag = New StateBag()
        Dim myPanelStyle As PanelStyle = New PanelStyle(panelState)

        ' Set the properties of the PanelStyle class.
        myPanelStyle.HorizontalAlign = HorizontalAlign.Center
        myPanelStyle.ScrollBars = ScrollBars.Both
        myPanelStyle.Wrap = False
        myPanelStyle.Direction = ContentDirection.LeftToRight
        myPanelStyle.BackImageUrl = "~\images\picture.jpg"

        ' Use the ApplyStyle method of the Panel control to apply
        ' the settings from the myPanelStyle object.
        Panel1.ApplyStyle(myPanelStyle)
        Panel2.ApplyStyle(myPanelStyle)
        
    End Sub

End Class

備註

屬性 ScrollBars 會指定捲軸在面板控制項中的可見度和位置。

屬性 ScrollBars 是使用其中 ScrollBars 一個列舉值來設定。 下表列出可能的值。

描述
None 不顯示捲軸。
Horizontal 只會顯示水準捲軸。
Vertical 只會顯示垂直捲動條。
Both 同時顯示水平和垂直捲軸。
Auto 如有必要,會顯示水準、垂直或兩個捲軸。 否則不顯示捲軸。

適用於

另請參閱