WaynesSlider class
A horizontal or vertical slider control — a draggable block over a track — for editing an integer value within a range. The user can drag the block, click on the track to step the value by one page, or use the arrow keys when the control has focus; an optional auto-increment timer activates while a mouse button is held down on the track.
The control paints three visual states (NormalState, HoverState, FocusedState) driven by parallel WaynesSliderState sub-objects, each of which carries independent fill / border / corner styling for the background and for the block. The current Value is optionally rendered as text on the block — as a raw integer or as a formatted percentage — depending on DisplayFormat.
If the control’s Height is greater than its Width on first display, the slider defaults to Direction = Vertical; otherwise it defaults to Horizontal.
Private Sub Form_Load()
sldVolume.MinValue = 0
sldVolume.MaxValue = 100
sldVolume.StepValue = 5
sldVolume.PagingStepValue = 10
sldVolume.DisplayFormat = SliderDisplayValueFormat.DisplayPercentage
End Sub
Value is just a Long property — assigning to it from outside the control moves the block and triggers a repaint. Combined with a WaynesTimer, the slider can animate itself across its range:
Private Sub Form_Load()
sldProgress.MinValue = 0
sldProgress.MaxValue = 100
sldProgress.Value = 0
Timer1.Interval = 50
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If sldProgress.Value < sldProgress.MaxValue Then
sldProgress.Value = sldProgress.Value + 1
Else
Timer1.Enabled = False
End If
End Sub
SliderDirection
The slider orientation enum, declared inside the WaynesSlider class. Assigned to Direction.
| Constant | Value | Description |
|---|---|---|
| Horizontal | 0 | Track runs left-to-right; arrow keys Left / Right step the value. |
| Vertical | 1 | Track runs top-to-bottom; arrow keys Up / Down step the value. |
SliderDisplayValueFormat
How the Value is rendered on the block, declared inside the WaynesSlider class. Assigned to DisplayFormat.
| Constant | Value | Description |
|---|---|---|
| DisplayValue | 0 | Show the raw integer value. |
| DisplayPercentage | 1 | Show the value as a percentage of the range — FormatPercent((Value - MinValue) / (MaxValue - MinValue), 1). |
| DisplayNone | 2 | No text on the block. |
Properties
Anchors
Which sides of the control are pinned to its container during resize. Anchors. Inherited.
Direction
Whether the slider is laid out horizontally or vertically. A member of SliderDirection. Default: chosen on first display from the control’s aspect ratio (vertical if Height > Width, else horizontal).
DisplayFormat
How the Value is rendered as text on the block. A member of SliderDisplayValueFormat. Default: DisplayValue.
Dock
How the control is docked inside its container. A member of DockMode. Inherited.
FocusedState
The WaynesSliderState used when the control has the keyboard focus and the mouse is not hovering.
Height
The control’s height in pixels. PixelCount. Inherited.
HoverState
The WaynesSliderState used when the mouse is hovering over the block or over the track.
Left
The horizontal offset of the control’s left edge from its container, in pixels. PixelCount. Inherited.
MaxValue
The upper bound of the slider’s value range. Long. Default: 100.
MinValue
The lower bound of the slider’s value range. Long. Default: 0.
MoveInterval
The interval, in milliseconds, between automatic increments of Value while a mouse button is held down on the track. Long. A value of 0 disables auto-repeat.
Name
The unique design-time name of the control on its parent form. String. Inherited.
NormalState
The WaynesSliderState used when the slider is at rest — not hovered, not focused.
PagingStepValue
How far Value moves when the user clicks on the track outside the block (or holds a mouse button down on the track). Long. Default: 1.
StepValue
The granularity of the slider — Value is rounded to a multiple of StepValue offset from MinValue before each paint. Long. Default: 1.
TabIndex
The position of the control in the form’s TAB-key navigation order. Long. Inherited.
TabStop
Whether the user can reach the control by pressing TAB. Boolean. Inherited. Default: True.
Top
The vertical offset of the control’s top edge from its container, in pixels. PixelCount. Inherited.
Value
The current position of the block within the range, as an integer. Long. Clamped to [MinValue, MaxValue] at paint time unless WrapAround is True.
Syntax: object.Value [ = value ]
Visible
Whether the control is currently displayed. Boolean. Inherited. Default: True.
Width
The control’s width in pixels. PixelCount. Inherited.
WrapAround
When False (the default), Value is clamped to the range [MinValue, MaxValue]. When True, values outside the range are allowed and the block wraps around — the slider paints additional block instances on the opposite edge to give a continuous visual. Boolean.