PanelStyle.ScrollBars Property

Definition

Gets or sets the visibility and position of scroll bars in a panel control.

C#
public virtual System.Web.UI.WebControls.ScrollBars ScrollBars { get; set; }

Property Value

One of the ScrollBars values. The default is None.

Exceptions

The ScrollBars property is not one of the ScrollBars values.

Examples

The following code example sets the ScrollBars properties of two panel controls, Panel1 and Panel2, to the ScrollBars.Both enumeration value. This code example is part of a larger example provided for the PanelStyle class.

C#
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); 
    }
}

Remarks

The ScrollBars property specifies the visibility and position of scroll bars in a panel control.

The ScrollBars property is set using one of the ScrollBars enumeration values. The following table lists the possible values.

Value Description
None No scroll bars are shown.
Horizontal Only a horizontal scroll bar is shown.
Vertical Only a vertical scroll bar is shown.
Both Both horizontal and vertical scroll bars are shown.
Auto If necessary, horizontal, vertical, or both scroll bars are shown. Otherwise, no scroll bars are shown.

Applies to

Produkt Verzie
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also