PanelStyle.Direction 属性

定义

获取或设置在面板控件中显示包含文本的控件的方向。Gets or sets the direction in which to display controls that include text in a panel control.

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 值之一。One of the ContentDirection values. 默认值为 NotSetThe default is NotSet.

例外

该方向不是 ContentDirection 值之一。The direction is not one of the ContentDirection values.

示例

下面的代码示例将 Direction 两个 panel 控件的属性 Panel1 和设置 Panel2ContentDirection.LeftToRight 枚举值。The following code example sets the Direction properties of two panel controls, Panel1 and Panel2, to the ContentDirection.LeftToRight enumeration value. 此代码示例是为类提供的更大示例的一部分 PanelStyleThis code example is part of a larger example provided for the PanelStyle class.

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属性指定在 panel 控件中显示包含文本的控件的方向。The Direction property specifies the direction in which to display controls that include text in a panel control.

Direction使用其中一个值设置属性 ContentDirectionThe Direction property is set using one of the ContentDirection values. 下表列出了可能的值。The following table lists the possible values.

Value 说明Description
NotSet 未设置内容方向。The content direction is not set.
LeftToRight 包含文本的子控件按从左到右的显示。Child controls that include text are displayed from left to right.
RightToLeft 包含文本的子控件从右到左显示。Child controls that include text are displayed from right to left.

如果指定 LeftToRight ,则包含文本的子控件从左到右显示。If you specify LeftToRight, child controls that include text display from left to right. 如果指定 RightToLeft ,则包含文本的子控件从右到左显示。If you specify RightToLeft, child controls that include text display right to left. 用于 RightToLeft 显示从右向左书写的语言(例如阿拉伯语或希伯来语)的文本。Use RightToLeft to display text for languages that are written from right to left, such as Arabic or Hebrew.

适用于

另请参阅