* Merge winforms framework content to working branch (#14) * Breadcrumb / TOC / Move net5 to net folder (#15) * change path from net5 to net * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Add .net 5 winforms placeholder article (#16) * added some metadata and adjusted net5 placeholder * corrections * corrections * corrections * Test1 * Swapping landing page vs concept * fix links * Fix links * Fix desc
3.7 KiB
title, ms.date, f1_keywords, helpviewer_keywords, ms.assetid
| title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| HScrollBar and VScrollBar Controls Overview | 03/30/2017 |
|
|
8b307679-1cae-41d8-99aa-3d1efd207cd6 |
HScrollBar and VScrollBar Controls Overview (Windows Forms)
Windows Forms xref:System.Windows.Forms.ScrollBar controls are used to provide easy navigation through a long list of items or a large amount of information by scrolling either horizontally or vertically within an application or control. Scroll bars are a common element of the Windows interface, so the xref:System.Windows.Forms.ScrollBar control is often used with controls that do not derive from the xref:System.Windows.Forms.ScrollableControl class. Similarly, many developers choose to incorporate the xref:System.Windows.Forms.ScrollBar control when authoring their own user controls.
The xref:System.Windows.Forms.HScrollBar (horizontal) and xref:System.Windows.Forms.VScrollBar (vertical) controls operate independently from other controls and have their own set of events, properties, and methods. xref:System.Windows.Forms.ScrollBar controls are not the same as the built-in scroll bars that are attached to text boxes, list boxes, combo boxes, or MDI forms (the xref:System.Windows.Forms.TextBox control has a xref:System.Windows.Forms.TextBox.ScrollBars%2A property to show or hide scroll bars that are attached to the control).
The xref:System.Windows.Forms.ScrollBar controls use the xref:System.Windows.Forms.ScrollBar.Scroll event to monitor the movement of the scroll box (sometimes referred to as the thumb) along the scroll bar. Using the xref:System.Windows.Forms.ScrollBar.Scroll event provides access to the scroll bar value as it is being dragged.
Value Property
The xref:System.Windows.Forms.ScrollBar.Value%2A property (which, by default, is 0) is an integer value corresponding to the position of the scroll box in the scroll bar. When the scroll box position is at the minimum value, it moves to the left-most position (for horizontal scroll bars) or the top position (for vertical scroll bars). When the scroll box is at the maximum value, the scroll box moves to the right-most or bottom position. Similarly, a value halfway between the bottom and top of the range places the leading edge of the scroll box in the middle of the scroll bar.
In addition to using mouse clicks to change the scroll bar value, a user can also drag the scroll box to any point along the bar. The resulting value depends on the position of the scroll box, but it is always within the range of the xref:System.Windows.Forms.ScrollBar.Minimum%2A to xref:System.Windows.Forms.ScrollBar.Maximum%2A properties set by the user.
LargeChange and SmallChange Properties
When the user presses the PAGE UP or PAGE DOWN key or clicks in the scroll bar track on either side of the scroll box, the xref:System.Windows.Forms.ScrollBar.Value%2A property changes according to the value set in the xref:System.Windows.Forms.ScrollBar.LargeChange%2A property.
When the user presses one of the arrow keys or clicks one of the scroll bar buttons, the xref:System.Windows.Forms.ScrollBar.Value%2A property changes according to the value set in the xref:System.Windows.Forms.ScrollBar.SmallChange%2A property.