System.Windows.Forms Namesp ...


.NET Framework Class Library
HScrollBar Class

Represents a standard Windows horizontal scroll bar.

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

Visual Basic (Declaration)
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class HScrollBar _
    Inherits ScrollBar
Visual Basic (Usage)
Dim instance As HScrollBar
C#
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
[ComVisibleAttribute(true)]
public class HScrollBar : ScrollBar
Visual C++
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)]
[ComVisibleAttribute(true)]
public ref class HScrollBar : public ScrollBar
JScript
public class HScrollBar extends ScrollBar
Remarks

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.

Examples

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

Visual Basic
Private Sub InitializeMyScrollBar()
    ' Create and initialize an HScrollBar.
    Dim hScrollBar1 As 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)
End Sub 'InitializeMyScrollBar
C#
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);
 }

Visual C++
private:
   void InitializeMyScrollBar()
   {
      // Create and initialize an HScrollBar.
      HScrollBar^ hScrollBar1 = gcnew 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 );
   }
JScript
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)
}
Inheritance Hierarchy

System..::.Object
  System..::.MarshalByRefObject
    System.ComponentModel..::.Component
      System.Windows.Forms..::.Control
        System.Windows.Forms..::.ScrollBar
          System.Windows.Forms..::.HScrollBar
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms

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.
Version Information

.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
See Also

Reference

Tags :


Page view tracker