Export (0) Print
Expand All
2 out of 4 rated this helpful - Rate this topic

ScrollBar Class

Implements the basic functionality of a scroll bar control.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
[ComVisibleAttribute(true)]
public abstract class ScrollBar : Control

You typically do not inherit directly from the ScrollBar class. To create your own scroll bar class, inherit from the VScrollBar or HScrollBar class.

NoteNote:

The scroll box is sometimes referred to as the scroll thumb.

To adjust the value range of the scroll bar control, set the Minimum and Maximum properties. To adjust the distance the scroll box moves, set the SmallChange and LargeChange properties. To adjust the starting point of the scroll box, set the Value property when the control is initially displayed.

User interface guidelines suggest that the SmallChange and LargeChange properties are set relative to the size of the view that the user sees, not to the total size including the unseen part. For example, if you have a picture box with scroll bars displaying a large image, the SmallChange and LargeChange properties should be set relative to the size of the picture box, not to the size of the image.

The following example creates and initializes a VScrollBar and adds it to a Form.

private void InitializeMyScrollBar()
 {
    // Create and initialize a VScrollBar.
    VScrollBar vScrollBar1 = new VScrollBar();

    // Dock the scroll bar to the right side of the form.
    vScrollBar1.Dock = DockStyle.Right;

    // Add the scroll bar to the form.
    Controls.Add(vScrollBar1);
 }
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

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.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.