Scrolls the specified child control into view on an auto-scroll enabled control.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
'Declaration Public Sub ScrollControlIntoView ( _ activeControl As Control _ ) 'Usage Dim instance As ScrollableControl Dim activeControl As Control instance.ScrollControlIntoView(activeControl)
- Type: System.Windows.Forms.Control
The child control to scroll into view.
The AutoScroll property must be set to true, and at least one of the scroll bars, horizontal or vertical, must also be visible, for the method to have an effect. To make the horizontal and vertical scroll bars visible, the HScroll and VScroll properties, respectively, must be set to true.
If the activeControl parameter is not a child control, no action takes place.
This method may raise the Scroll event.
The following code example enables auto-scrolling for a form, resizes the form, and ensures that a button remains visible after the form is resized. The example requires that you have a Form with a Button named button2 on it.
Private Sub ResizeForm() ' Enable auto-scrolling for the form. Me.AutoScroll = True ' Resize the form. Dim r As Rectangle = Me.ClientRectangle ' Subtract 100 pixels from each side of the Rectangle. r.Inflate(- 100, - 100) Me.Bounds = Me.RectangleToScreen(r) ' Make sure button2 is visible. Me.ScrollControlIntoView(button2) End Sub
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.