System.Windows.Forms.ScrollableControl.AutoScroll Property

Gets or sets a value indicating whether the container enables the user to scroll to any controls placed outside of its visible boundaries.

Syntax

[System.ComponentModel.Localizable(true)]
[System.ComponentModel.DefaultValue(false)]
public virtual bool AutoScroll { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

When true, this property enables the container to have a virtual size that is larger than its visible boundaries.

There is currently a limitation in Windows Forms that prevents all classes derived from System.Windows.Forms.ScrollableControl from acting properly when both Control.RightToLeft is enabled and ScrollableControl.AutoScroll is set to RightToLeft.Yes. For example, let's say that you place a control such as System.Windows.Forms.Panel—or a container class derived from System.Windows.Forms.Panel (such as System.Windows.Forms.FlowLayoutPanel or System.Windows.Forms.TableLayoutPanel)—on your form. If you set ScrollableControl.AutoScroll on the container to RightToLeft.Yes and then set the Control.Anchor property on one or more of the controls inside of the container to AnchorStyles.Right, then no scrollbar ever appears. The class derived from System.Windows.Forms.ScrollableControl acts as if ScrollableControl.AutoScroll were set to RightToLeft.No.

Currently, the only workaround is to nest the System.Windows.Forms.ScrollableControl inside another System.Windows.Forms.ScrollableControl. For instance, if you need System.Windows.Forms.TableLayoutPanel to work in this situation, you can place it inside of a System.Windows.Forms.Panel control and set ScrollableControl.AutoScroll on the System.Windows.Forms.Panel to RightToLeft.Yes.

Note:

ScrollableControl.AutoScroll maintains the visibility of the scrollbars automatically. Therefore, setting the ScrollableControl.HScroll or ScrollableControl.VScroll property to true has no effect when ScrollableControl.AutoScroll is enabled.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0