語言

PanelStyle.Direction 屬性

定義

設定顯示包含文字的控制項的方向。

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

屬性值

這是其中一項 ContentDirection 價值。 預設值為 NotSet。

例外狀況

導演方向不是其中 ContentDirection 的價值觀之一。

範例

以下程式碼範例將兩個面板控制Direction項 和 Panel1的屬性設Panel2為ContentDirection.LeftToRight列舉值。 此程式碼範例是本類別更大範例 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

備註

該 Direction 屬性指定在面板控制中顯示包含文字的控制項的方向。

屬性 Direction 是用其中一個 ContentDirection 值設定的。 下表列出可能的數值。

價值觀 Description
NotSet 內容方向尚未確定。
LeftToRight 包含文字的子控制器會從左到右顯示。
RightToLeft 包含文字的兒童控制項會從右到左顯示。

如果你指定 LeftToRight包含文字的子控制項,會從左到右顯示。 如果你指定 RightToLeft包含文字的子控制項會從右到左顯示。 用於 RightToLeft 顯示從右到左書寫的語言文字,例如阿拉伯語或希伯來語。

適用於

另請參閱