PanelStyle.ScrollBars 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定面板控制中滾動條的可見性和位置。
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 價值。 預設值為 None。
例外狀況
ScrollBars房產並非其中一項價值ScrollBars。
範例
以下程式碼範例將兩個面板控制Panel1項 和 Panel2的屬性設ScrollBars為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 |
如有必要,會顯示橫向、垂直或雙向捲軸條。 否則,不會顯示捲動條。 |