HypernovaDesktop Components · docs
Binarymission
WinFormsScroll Bars › ScrollBarBase

ScrollBarBase

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WinForms.Controls.ScrollBars

The base ScrollBarBase class. This is not intended to be derived outside of the Binarymission scrollbars assembly.

public abstract class ScrollBarBase : Control

Inherits from / implements: Control

Members at a glance

ScrollBarBaseInitializes a new instance of the ScrollBarBase class.
ScrollBarBaseInitializes a new instance of the ScrollBarBase class docked into the given host.
EarlierScrollPositionGets the earlier scroll position.
HorizontalScrollBarHeightGets or sets the height of the horizontal scroll bar.
IsDrawingCustomThumbImageTrue while the thumb is being drawn from a caller-supplied image. The grip marks are suppressed in that case, so that a custom thumb image is not drawn over.
LargeChangeGets or sets the large change.
MaximumScrollRangeGets or sets the maximum scroll range.
MinimumScrollRangeGets or sets the minimum scroll range.
PaddingGapGets or sets the padding gap.
PositionGets or sets the current scroll position.
ScrollBarNavigationButtonRendererGets or sets a custom scroll bar renderer for painting the navigation button and their content.
ScrollBarRenderingConfiguratorGets or sets the scroll bar rendering configurator.
ScrollBarThumbGripperRendererGets or sets a custom scroll bar renderer for painting the thumb gripper.
ScrollBarThumbRendererGets or sets a custom scroll bar renderer for painting the thumb.
ScrollBarTrackRendererGets or sets a custom scroll bar renderer for painting the track.
ScrollServiceTargetControlGets or sets the scroll service target control.
ShouldAutomaticallyPositionScrollerGets or sets a value indicating whether the control should automatically position scroller.
SmallChangeGets or sets the small change.
VerticalScrollBarWidthGets or sets the width of the vertical scroll bar.
DrawScrollNavigatorDraws one arrow button, through the navigation button renderer when one is set.
DrawThumbArtefactConditionalDraws the thumb, through the thumb renderer when one is set, and only when there is a thumb to draw - a range that fits entirely in view has none.
GetThumbArtefactRectangleReturns where the thumb is to be drawn. Override to change the thumb geometry without touching the rest of the painting.
IsInputKeyReports whether this control wants a key that the framework would otherwise treat as navigation.
OnDpiChangedAfterParentRaises the DpiChangedAfterParent event, so the bar follows a window that has been moved to a display at another scale.
OnHandleCreatedRaises the HandleCreated event. ScrollBarBase overrides it so the control's own handling runs alongside the base behavior.
OnKeyDownRaises the KeyDown event. ScrollBarBase overrides it so the control's own handling runs alongside the base behavior.
OnKeyUpRaises the KeyUp event. ScrollBarBase overrides it so the control's own handling runs alongside the base behavior.
OnMouseWheelRaises the MouseWheel event. ScrollBarBase overrides it so the control's own handling runs alongside the base behavior.
OnPaintRaises the Paint event. ScrollBarBase overrides it so the control's own handling runs alongside the base behavior.
OnParentChangedRaises the ParentChanged event. ScrollBarBase overrides it so the control's own handling runs alongside the base behavior.
OnTabStopChangedRaises the TabStopChanged event. ScrollBarBase overrides it so the control's own handling runs alongside the base behavior.
PaintBackgroundDraws the track behind the thumb, through the track renderer when one is set.
PaintScrollBarDraws the whole scroll bar. The base does nothing; each concrete scroll bar overrides it and drives the individual paint helpers in the order its orientation needs.
PerformSizeRefreshRecalculates the layout after the control or its range changes. The base does nothing; each concrete scroll bar overrides it for its own orientation.
WndProcProcesses the Windows messages sent to this control's window.
HorizontalScrollBarHeightChangedOccurs when horizontal scroll bar height changes.
PositionChangedOccurs when the scroll position changed.
VerticalScrollBarWidthChangedOccurs when vertical scroll bar width changes.
_earlierScrolledPositionThe position before the current move, which is what the change notification reports as the old value.
_executeNavigationEventGates the scroll notification while a drag is in progress, so subscribers are told once the position settles rather than on every intermediate pixel.
_gripperArtefactHeightHeight in pixels of the grip marks drawn on the thumb.
_gripperArtefactWidthWidth in pixels of the grip marks drawn on the thumb.
_largeChangeHow far one click on the track, either side of the thumb, moves the position.
_maximumScrollRangeThe high end of the range the thumb travels over.
_minimumScrollRangeThe low end of the range the thumb travels over.
_parentInstanceUsingThisScrollerInstanceThe control this scroll bar is docked into, taken from the dock host passed to the constructor.
_performCarefulSizingSet when this scroll bar shares its host with a sibling scroll bar, so that resizing leaves room for the other one and for the corner square between them.
_scrollPositionWhere the thumb currently sits within the range. Kept as a double so that a long range still moves smoothly over a short track.
_scrollServiceTargetControlThe control this scroll bar scrolls. It is not necessarily the parent: a scroll bar can be docked in one container and drive the content of another.
_shouldAutoScrolingActionEndSet to end the auto-repeat loop that runs while an arrow or the track is held down.
_smallChangeHow far one arrow-button click moves the position.
_usingSiblingReserved. Nothing in the library reads this field; it is protected, so it is part of the published surface and is left in place for source compatibility.

Constructors

ScrollBarBase

protected ScrollBarBase()

Initializes a new instance of the ScrollBarBase class.

ScrollBarBase

protected ScrollBarBase(IScrollersDockHost parentInstanceUsingThisScrollerInstance)

Initializes a new instance of the ScrollBarBase class docked into the given host.

parentInstanceUsingThisScrollerInstance
The host this scroll bar docks into.

Properties

EarlierScrollPosition

public double EarlierScrollPosition

Gets the earlier scroll position.

Value. The earlier scroll position.

HorizontalScrollBarHeight

public virtual int HorizontalScrollBarHeight

Gets or sets the height of the horizontal scroll bar.

Value. The height of the horizontal scroll bar.

IsDrawingCustomThumbImage

protected bool IsDrawingCustomThumbImage

True while the thumb is being drawn from a caller-supplied image. The grip marks are suppressed in that case, so that a custom thumb image is not drawn over.

LargeChange

public int LargeChange

Gets or sets the large change.

Value. The large change.

MaximumScrollRange

public int MaximumScrollRange

Gets or sets the maximum scroll range.

Value. The maximum scroll range.

MinimumScrollRange

public int MinimumScrollRange

Gets or sets the minimum scroll range.

Value. The minimum scroll range.

PaddingGap

public int PaddingGap

Gets or sets the padding gap.

Value. The padding gap.

Position

public double Position

Gets or sets the current scroll position.

Value. The current scroll position.

ScrollBarNavigationButtonRenderer

public IScrollBarNavigationButtonRenderer ScrollBarNavigationButtonRenderer

Gets or sets a custom scroll bar renderer for painting the navigation button and their content.

ScrollBarRenderingConfigurator

public ScrollBarRenderingConfigurator ScrollBarRenderingConfigurator

Gets or sets the scroll bar rendering configurator.

Value. The scroll bar rendering configurator.

ScrollBarThumbGripperRenderer

public IScrollBarThumbGripperRenderer ScrollBarThumbGripperRenderer

Gets or sets a custom scroll bar renderer for painting the thumb gripper.

ScrollBarThumbRenderer

public IScrollBarThumbRenderer ScrollBarThumbRenderer

Gets or sets a custom scroll bar renderer for painting the thumb.

ScrollBarTrackRenderer

public IScrollBarTrackRenderer ScrollBarTrackRenderer

Gets or sets a custom scroll bar renderer for painting the track.

ScrollServiceTargetControl

public Control ScrollServiceTargetControl

Gets or sets the scroll service target control.

Value. The scroll service target control.

ShouldAutomaticallyPositionScroller

public bool ShouldAutomaticallyPositionScroller

Gets or sets a value indicating whether the control should automatically position scroller.

If set to true, the scroll bar controls will automatically dock to the parent control (to its right for vertical mode, and bottom for horizontal mode).

SmallChange

public int SmallChange

Gets or sets the small change.

Value. The small change.

VerticalScrollBarWidth

public virtual int VerticalScrollBarWidth

Gets or sets the width of the vertical scroll bar.

Value. The width of the vertical scroll bar.

Methods

DrawScrollNavigator

protected virtual void DrawScrollNavigator(Graphics graphicsInstance, Rectangle targetRectangle, ArrowDrawingArtefact arrowDrawingArtefact, ControlVisualState controlVisualState)

Draws one arrow button, through the navigation button renderer when one is set.

graphicsInstance
The surface to draw on.
targetRectangle
The bounds of the button.
arrowDrawingArtefact
Which way the arrow points.
controlVisualState
Whether the button is idle, hot or pressed.

DrawThumbArtefactConditional

protected virtual void DrawThumbArtefactConditional(Graphics graphicsInstance, ControlVisualState controlVisualState)

Draws the thumb, through the thumb renderer when one is set, and only when there is a thumb to draw - a range that fits entirely in view has none.

graphicsInstance
The surface to draw on.
controlVisualState
Whether the thumb is idle, hot or pressed.

GetThumbArtefactRectangle

protected virtual Rectangle GetThumbArtefactRectangle()

Returns where the thumb is to be drawn. Override to change the thumb geometry without touching the rest of the painting.

Returns. The bounds of the thumb, in client coordinates.

IsInputKey

protected override bool IsInputKey(Keys keyData)

Reports whether this control wants a key that the framework would otherwise treat as navigation.

OnDpiChangedAfterParent

protected override void OnDpiChangedAfterParent(EventArgs e)

Raises the DpiChangedAfterParent event, so the bar follows a window that has been moved to a display at another scale.

e
Not used.

OnHandleCreated

protected override void OnHandleCreated(EventArgs e)

Raises the HandleCreated event. ScrollBarBase overrides it so the control's own handling runs alongside the base behavior.

e
The data for the event.

OnKeyDown

protected override void OnKeyDown(KeyEventArgs e)

Raises the KeyDown event. ScrollBarBase overrides it so the control's own handling runs alongside the base behavior.

e
The data for the event.

OnKeyUp

protected override void OnKeyUp(KeyEventArgs e)

Raises the KeyUp event. ScrollBarBase overrides it so the control's own handling runs alongside the base behavior.

e
The data for the event.

OnMouseWheel

protected override void OnMouseWheel(MouseEventArgs e)

Raises the MouseWheel event. ScrollBarBase overrides it so the control's own handling runs alongside the base behavior.

e
The data for the event.

OnPaint

protected override void OnPaint(PaintEventArgs e)

Raises the Paint event. ScrollBarBase overrides it so the control's own handling runs alongside the base behavior.

e
The data for the event.

OnParentChanged

protected override void OnParentChanged(EventArgs e)

Raises the ParentChanged event. ScrollBarBase overrides it so the control's own handling runs alongside the base behavior.

e
The data for the event.

OnTabStopChanged

protected override void OnTabStopChanged(EventArgs e)

Raises the TabStopChanged event. ScrollBarBase overrides it so the control's own handling runs alongside the base behavior.

e
The data for the event.

PaintBackground

protected virtual void PaintBackground(Graphics g)

Draws the track behind the thumb, through the track renderer when one is set.

g
The surface to draw on.

PaintScrollBar

protected virtual void PaintScrollBar(Graphics g)

Draws the whole scroll bar. The base does nothing; each concrete scroll bar overrides it and drives the individual paint helpers in the order its orientation needs.

g
The surface to draw on.

PerformSizeRefresh

protected virtual void PerformSizeRefresh()

Recalculates the layout after the control or its range changes. The base does nothing; each concrete scroll bar overrides it for its own orientation.

WndProc

protected override void WndProc(ref Message m)

Processes the Windows messages sent to this control's window.

Events

HorizontalScrollBarHeightChanged

public event EventHandler HorizontalScrollBarHeightChanged

Occurs when horizontal scroll bar height changes.

PositionChanged

public event EventHandler<PositionChangedArgs> PositionChanged

Occurs when the scroll position changed.

VerticalScrollBarWidthChanged

public event EventHandler VerticalScrollBarWidthChanged

Occurs when vertical scroll bar width changes.

Fields

_earlierScrolledPosition

protected double _earlierScrolledPosition

The position before the current move, which is what the change notification reports as the old value.

_executeNavigationEvent

protected bool _executeNavigationEvent

Gates the scroll notification while a drag is in progress, so subscribers are told once the position settles rather than on every intermediate pixel.

_gripperArtefactHeight

protected int _gripperArtefactHeight

Height in pixels of the grip marks drawn on the thumb.

_gripperArtefactWidth

protected int _gripperArtefactWidth

Width in pixels of the grip marks drawn on the thumb.

_largeChange

protected int _largeChange

How far one click on the track, either side of the thumb, moves the position.

_maximumScrollRange

protected int _maximumScrollRange

The high end of the range the thumb travels over.

_minimumScrollRange

protected int _minimumScrollRange

The low end of the range the thumb travels over.

_parentInstanceUsingThisScrollerInstance

protected readonly Control _parentInstanceUsingThisScrollerInstance

The control this scroll bar is docked into, taken from the dock host passed to the constructor.

_performCarefulSizing

protected bool _performCarefulSizing

Set when this scroll bar shares its host with a sibling scroll bar, so that resizing leaves room for the other one and for the corner square between them.

_scrollPosition

protected double _scrollPosition

Where the thumb currently sits within the range. Kept as a double so that a long range still moves smoothly over a short track.

_scrollServiceTargetControl

protected Control _scrollServiceTargetControl

The control this scroll bar scrolls. It is not necessarily the parent: a scroll bar can be docked in one container and drive the content of another.

_shouldAutoScrolingActionEnd

protected bool _shouldAutoScrolingActionEnd

Set to end the auto-repeat loop that runs while an arrow or the track is held down.

_smallChange

protected int _smallChange

How far one arrow-button click moves the position.

_usingSibling

protected bool _usingSibling

Reserved. Nothing in the library reads this field; it is protected, so it is part of the published surface and is left in place for source compatibility.