PanelStyle.HorizontalAlign 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定面板控制內內容的水平對齊。
public:
virtual property System::Web::UI::WebControls::HorizontalAlign HorizontalAlign { System::Web::UI::WebControls::HorizontalAlign get(); void set(System::Web::UI::WebControls::HorizontalAlign value); };
public virtual System.Web.UI.WebControls.HorizontalAlign HorizontalAlign { get; set; }
member this.HorizontalAlign : System.Web.UI.WebControls.HorizontalAlign with get, set
Public Overridable Property HorizontalAlign As HorizontalAlign
屬性值
這是其中一項 HorizontalAlign 價值。 預設值為 NotSet。
例外狀況
水平排列並不是其中一個數 HorizontalAlign 值。
範例
以下程式碼範例將兩個面板控制Panel1項 和 Panel2的屬性設HorizontalAlign為HorizontalAlign.Center列舉值。 如需可用於執行範例的.aspx檔案,請參見主題。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
備註
該 HorizontalAlign 屬性指定面板控制內內容物的水平對齊。
HorizontalAlign屬性是利用列HorizontalAlign舉值之一設定的。 下表列出可能的數值。
| 價值 | 說明 |
|---|---|
NotSet |
水平排列尚未設定。 |
Left |
面板內容為左對齊。 |
Center |
面板內容置中。 |
Right |
面板內容為右對齊。 |
備註
。 如果屬性 HorizontalAlign 設定為 , NotSet 但該屬性設定在包含面板控制項的控制項中,則該設定會繼承自包含面板控制項的控制項。