Redigera

Dela via


PanelStyle.Direction Property

Definition

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

Property Value

One of the ContentDirection values. The default is NotSet.

Exceptions

The direction is not one of the ContentDirection values.

Examples

The following code example sets the Direction properties of two panel controls, Panel1 and Panel2, to the ContentDirection.LeftToRight enumeration value. This 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

Remarks

The Direction property specifies the direction in which to display controls that include text in a panel control.

The 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.

If you specify LeftToRight, child controls that include text display from left to right. If you specify RightToLeft, child controls that include text display right to left. Use RightToLeft to display text for languages that are written from right to left, such as Arabic or Hebrew.

Applies to

See also