[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Forms' (#lcl)

# TScrollingWinControl.CalculateAutoRanges

Sets or resets the ranges used for scroll bars on the control.

## Declaration

Source position: forms.pp line 181

`protected procedure TScrollingWinControl.CalculateAutoRanges; virtual;`

## Description

CalculateAutoRanges calculates the preferred size for the control - both with and without scroll bars. The Range properties in HorzScrollBar and VertScrollBar are updated to reflect the logical (virtual) size for the content on the control. The Range value is set to 0 if the scroll bar is not visible.

Used in the implementation of the ComputeScrollbars method.

## See also

TScrollingWinControl.ComputeScrollbars |  | Updates Page, AutoRange, IsScrollBarVisible, and returns True when changed.
TScrollingWinControl.HorzScrollBar |  | The horizontal scroll bar for the control.
TScrollingWinControl.VertScrollBar |  | The vertical scroll bar for the control.
TScrollingWinControl.GetPreferredSizeClientFrame |  | Calculates the size of the client area for the control excluding visible scroll bars.
TControl.GetPreferredSize |  | Returns default/preferred height and width, for use in auto-sizing.