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

其中一個 ContentDirection 值。 預設為 NotSet

例外狀況

這個方向不是其中一個 ContentDirection 值。

範例

下列程式碼範例會將 Direction 兩個面板控制項 Panel1Panel2 的屬性設定為 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 一個值來設定。 下表列出可能的值。

描述
NotSet 未設定內容方向。
LeftToRight 包含文字的子控制項會從左至右顯示。
RightToLeft 包含文字的子控制項會從右至左顯示。

如果您指定 LeftToRight ,則包含文字顯示從左至右的子控制項。 如果您指定 RightToLeft ,則包含文字的子控制項會由右至左顯示。 用於 RightToLeft 顯示從右至左撰寫之語言的文字,例如阿拉伯文或希伯來文。

適用於

另請參閱