PanelStyle.Wrap 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會取得或設定一個值,表示內容是否包裹在面板內。
public:
virtual property bool Wrap { bool get(); void set(bool value); };
public virtual bool Wrap { get; set; }
member this.Wrap : bool with get, set
Public Overridable Property Wrap As Boolean
屬性值
true如果內容包裹在面板內;否則,。 false 預設值為 true。
範例
以下程式碼範例將 Panel1Panel2兩個面板控制項的屬性設Wrap為 ,false且 。 此程式碼範例是本類別更大範例 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
備註
該 Wrap 屬性表示內容是否包裹在面板內。 當屬性 Wrap 設為 false ,屬性 ScrollBars 設為 Auto時,若面板內容長度超過面板容量,面板內容會以一行顯示,並以水平捲動條呈現。 當屬性 Wrap 設定為 false ,屬性 ScrollBars 設定為 None時,面板會延伸,必要時網頁會有水平捲動條。