TMlSkinScrollBar

The skinned scrollbar. It can be used on its own and is also what the memo, list view and scroll box use internally.

Category
Scrollbars
Unit
uMlSkinScrollBar.pas
Inherits from
TMlSkinCustomControl

Notes

  • Position is the current offset, MinMax the range, and PageSize the size of one page.
  • SmallChange is the step for an arrow click and LargeChange the step for clicking the empty track.
  • The look comes from the Scrollbar_… image properties: thumb and arrows each have normal, hot and pressed states, with separate sets for the horizontal and vertical bars.
  • AutoHide hides the bar when the content does not need scrolling.

Example

From the demo MlSkin.Demo.360云盘.v3.0 (.dfm form file)

object mlsknscrlbr1: TMlSkinScrollBar
  Left = 870
  Top = 0
  Width = 10
  Height = 453
  Scrollbar_bar_down = 'MlSkinScrollbar_bar_down'
  Scrollbar_bar_highlight = 'MlSkinScrollbar_bar_highlight'
  Scrollbar_bar_normal = 'MlSkinScrollbar_bar_normal'
  Scrollbar_bkg = 'MlSkinScrollbar_bkg'
  Scrollbar_arrowdown_normal = 'MlSkinScrollbar_arrowdown_normal'
  Scrollbar_arrowup_normal = 'MlSkinScrollbar_arrowup_normal'
  Scrollbar_horz_bkg = 'MlSkinScrollbar_horz_bkg'
  Scrollbar_horzbar_down = 'MlSkinScrollbar_horzbar_down'
  Scrollbar_horzbar_highlight = 'MlSkinScrollbar_horzbar_highlight'
  Scrollbar_horzbar_normal = 'MlSkinScrollbar_horzbar_normal'
  Scrollbar_arrowleft_normal = 'MlSkinScrollbar_arrowleft_normal'
  Scrollbar_arrowright_normal = 'MlSkinScrollbar_arrowright_normal'
  Scrollbar_arrowdown_down = 'MlSkinScrollbar_arrowdown_down'
  Scrollbar_arrowdown_highlight = 'MlSkinScrollbar_arrowdown_highlight'
  Scrollbar_arrowleft_down = 'MlSkinScrollbar_arrowleft_down'

Properties 29

NameTypeDefaultDescription
Scrollbar_bar_downTMlResIDVertical scrollbar thumb, pressed state.
Scrollbar_bar_highlightTMlResIDVertical scrollbar thumb, hot state.
Scrollbar_bar_normalTMlResIDVertical scrollbar thumb, normal state.
Scrollbar_bkgTMlResIDVertical scrollbar track background.
Scrollbar_arrowdown_normalTMlResIDDown arrow, normal state.
Scrollbar_arrowup_normalTMlResIDUp arrow, normal state.
Scrollbar_horz_bkgTMlResIDHorizontal scrollbar track background.
Scrollbar_horzbar_downTMlResIDHorizontal scrollbar thumb, pressed state.
Scrollbar_horzbar_highlightTMlResIDHorizontal scrollbar thumb, hot state.
Scrollbar_horzbar_normalTMlResIDHorizontal scrollbar thumb, normal state.
Scrollbar_arrowleft_normalTMlResIDLeft arrow, normal state.
Scrollbar_arrowright_normalTMlResIDRight arrow, normal state.
Scrollbar_arrowdown_downTMlResIDDown arrow, pressed state.
Scrollbar_arrowdown_highlightTMlResIDDown arrow, hot state.
Scrollbar_arrowleft_downTMlResIDLeft arrow, pressed state.
Scrollbar_arrowleft_highlightTMlResIDLeft arrow, hot state.
Scrollbar_arrowright_downTMlResIDRight arrow, pressed state.
Scrollbar_arrowright_highlightTMlResIDRight arrow, hot state.
Scrollbar_arrowup_downTMlResIDUp arrow, pressed state.
Scrollbar_arrowup_highlightTMlResIDUp arrow, hot state.
AutoHideBooleanFalseHides the scrollbar automatically when the content does not need scrolling.
CanFocusedBooleanFalseWhether the control can take focus. With it off, clicking does not steal focus and Tab skips it.
KindTScrollBarKindsbHorizontalScrollbar orientation: horizontal or vertical.
PageSizeInteger0Size of one page, which also sets how long the thumb is.
MinInteger0Lower bound of the scroll range.
MaxInteger100Upper bound of the scroll range.
PositionInteger0Current position of the scrollbar.
SmallChangeInteger1How far one arrow click scrolls.
LargeChangeInteger1How far a click on the empty track scrolls, i.e. one page.

Events 6

NameTypeDefaultDescription
OnChangeTNotifyEventFires when the content changes.
OnLastChangeTNotifyEventFires when scrolling reaches the end, which is a good place to load more content.
OnUpButtonClickTNotifyEventFires when the up arrow is clicked.
OnDownButtonClickTNotifyEventFires when the down arrow is clicked.
OnPageUpTNotifyEventFires when the user pages up.
OnPageDownTNotifyEventFires when the user pages down.
Properties of TMlSkinCustomControl 5
NameTypeDefaultDescription
AboutTMlAboutInfoA design-time property: double-clicking it in the Object Inspector opens the MLSkin about box with the component version. It has no effect at run time and is not stored in the .dfm.
TransparentBooleanTrueTransparent background: the control skips its own fill and shows the form background (image or color) instead.
ColorTColorclWhiteBackground color of the control; ignored while Transparent is on.
AutoInvalidateBooleanFalseRepaints automatically when the content changes. Turn it on if property changes do not show up.
EraseBackgroundBooleanFalseWhether the background is erased before painting; worth toggling if the control flickers.
Events of TMlSkinCustomControl 4
NameTypeDefaultDescription
OnDPIChangedTMlDPIChangedEventFires when the screen DPI changes, for example when the window moves to a monitor with a different scaling — a good place to re-adjust anything you draw yourself.
OnBackgroundChangingTMlBackgroundEventFires just before the background changes, giving you a chance to adjust what is drawn.
OnBackgroundChangedTMlCustomDrawEventFires after the background has been drawn, so you can paint on top of it.
OnVisibleChangedTNotifyEventFires when the control is shown or hidden.

Only the properties and events MLSkin adds are listed here. Standard VCL properties such as Align, Anchors, Font and OnClick are available too and behave exactly as on the stock controls.

Offline helpA PDF / CHM version is available for offline reading.