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。
示例
下面的代码示例将 Wrap 属性设置为 false 两个面板控件, Panel1 以及 Panel2。 该代码示例是 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时,面板将扩展,如有必要,网页将具有水平滚动条。