Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

HScrollBar Class

Represents a standard Windows horizontal scroll bar.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
[ComVisibleAttribute(true)] 
public class HScrollBar : ScrollBar
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class HScrollBar extends ScrollBar
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class HScrollBar extends ScrollBar

Most controls that need scroll bars already provide them and do not require this control. This is true of a multiline TextBox control, a ListBox, and a ComboBox, for example.

You can use this control to implement scrolling in containers that do not provide their own scroll bars such as a PictureBox or for user input of numeric data. The numeric data can be displayed in a control or used in code. The Minimum and Maximum properties determine the range of values the user can select. The LargeChange property determines the effect of clicking within the scroll bar but outside the scroll box. The SmallChange property determines the effect of clicking the scroll arrows at each end of the control.

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

private void InitializeMyScrollBar()
 {
    // Create and initialize an HScrollBar.
    HScrollBar hScrollBar1 = new HScrollBar();
    
    // Dock the scroll bar to the bottom of the form.
    hScrollBar1.Dock = DockStyle.Bottom;
    
    // Add the scroll bar to the form.
    Controls.Add(hScrollBar1);
 }
    

private void InitializeMyScrollBar()
{
    // Create and initialize an HScrollBar.
    HScrollBar hScrollBar1 = new HScrollBar();

    // Dock the scroll bar to the bottom of the form.
    hScrollBar1.set_Dock(DockStyle.Bottom);

    // Add the scroll bar to the form.
    get_Controls().Add(hScrollBar1);
} //InitializeMyScrollBar

function InitializeMyScrollBar(){
    // Create and initialize an HScrollBar.
    var hScrollBar1 : HScrollBar = new HScrollBar()
    
    // Dock the scroll bar to the bottom of the form.
    hScrollBar1.Dock = DockStyle.Bottom
    
    // Add the scroll bar to the form.
    Controls.Add(hScrollBar1)
}

System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
       System.Windows.Forms.Control
         System.Windows.Forms.ScrollBar
          System.Windows.Forms.HScrollBar

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 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft