ScrollBar.Scroll Event

 

Occurs when the scroll box has been moved by either a mouse or keyboard action.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member Scroll : IEvent<ScrollEventHandler,
    ScrollEventArgs>

For more information about handling events, see NIB: Consuming Events.

The following example scrolls an image in a picture box. It uses the Value of the scrollbar to redraw a new part of the image whenever the user scrolls. This code example is part of a larger example provided for the ScrollBar class overview.

System_CAPS_noteNote

For instructions about how to run this example in Visual Studio, see How to: Compile and Run a Complete Windows Forms Code Example Using Visual Studio.

No code example is currently available or this language may not be supported.

The following code example uses the derived class VScrollBar. Event handlers for the Scroll and ValueChanged events are created. This code assumes that a Label and Button have been created on a form and that the button has an event handler for the Click event. When the button is clicked, the Value property of the scroll bar is adjusted in code. The label will display the current value of the Value property and the event that changed it. You will notice that when the scroll value is changed by the button's Click event, only the ValueChanged event is raised. In contrast, when the scroll bar is scrolled manually, the Scroll event is raised immediately after the ValueChanged event.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: