I normally prefer the length of a scroll bar to be some logical range minus the width of the slider. This way, when it has moved the maximum amount, some text (or whatever) is still displayed.
The size of the Slider is automatically adjusted according to the Min, Max, Length, and LargeChange parameters.
Unfortunately, in VB 6, the scrollbars are white - in all other windows applications, they are gray (or what you've configured via the control panel). Also, the various values are stored as integers (+/- ~32,000). In English, that means that it is difficult to control a display with more than ~32,000 rows.
Min | Usually set to zero or one |
Max | Set this to the number of rows in the file minus the number of rows displayed. If you want to scroll past the last row, then set it larger. |
Value | Where the slider is located. |
LargeChange | Amount Value is changed when the user clicks above or below the slider, or presses PgUp or PgDn keys. |
SmallChange | Amount Value is changed when the user clicks an arrow or presses the up and down arrow keys. |
Change | Called any time Min, Max, Value, and perhaps other paramters are changed. If the same value is written to a parameter, Change is not called. |
Scroll | Called when the user drags the slider. |
Min | Usually set to zero or one |
Max | |
Position | Current position of the slider (thumb tab). |
LargeChange | Amount Position is changed when the user clicks above or below the slider. |
SmallChange | Amount Position is changed when the user clicks an arrow or presses the up and down arrow keys. |
PageSize | Amount Position is changed when the user presses the PgUp or PgDn keys. Also controls the size of the slider (thumb tab). 0 = default size |
Kind | Horizontal or vertical |
The TScrollBar Example states that the range for Min and Max is [0, 65535]. If this is exceeded, then the OnScroll event will fail. This warning is not repeated in the OnScroll help.
Important events
OnChange | Called any time Position is changed. |
OnScroll | Called when the user drags the slider. |
You can disable one or both arrows.
Windows automatically hides a ScrollBar if the minimum and maximum values are equal or if the page size includes the entire scroll range.
MaxScrollPos = MaxRangeValue - (PageSize - 1)
Use GetSystemMetrics to get the widths of the related bitmaps.