System.Windows.Forms.ScrollableControl.AutoScrollMargin Property

Gets or sets the size of the auto-scroll margin.

Syntax

[System.ComponentModel.Localizable(true)]
public System.Drawing.Size AutoScrollMargin { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

The auto-scroll margin is the distance between any child controls and the edges of the scrollable parent control. The ScrollableControl.AutoScrollMargin size is added to the size of any child controls contained in the scrollable control to determine whether or not scroll bars are needed. The ScrollableControl.AutoScrollMargin property is evaluated when the parent scrollable control is resized or the individual child controls are brought into view, and is used to determine if scroll bars must be displayed. Docked controls are excluded from the calculations that determine if scroll bars must be displayed.

Note:

If a docked control's Control.Dock property is set to DockStyle.Fill, the control fills the parent scrollable control and the docked control is ignored when using the ScrollableControl.AutoScrollMargin to determine whether scroll bars are needed.

If the distance from the edge of a child control to the parent scrollable control is less than the value assigned to the ScrollableControl.AutoScrollMargin property and the ScrollableControl.AutoScroll property is set to true, the appropriate scroll bar is displayed.

Note:

We recommend, when docking controls within a scrollable control, that you add a child scrollable control, such as a System.Windows.Forms.Panel, to contain any other controls that might require scrolling. You should add the child System.Windows.Forms.Panel control to the scrollable control and its Control.Dock property set to DockStyle.Fill and its ScrollableControl.AutoScroll property set to true. You should set the ScrollableControl.AutoScroll property of the parent scrollable control to false.

Requirements

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