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, Min–Max 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_downTMlResID—Vertical scrollbar thumb, pressed state.
Scrollbar_bar_highlightTMlResID—Vertical scrollbar thumb, hot state.
Scrollbar_bar_normalTMlResID—Vertical scrollbar thumb, normal state.
Scrollbar_bkgTMlResID—Vertical scrollbar track background.
Scrollbar_arrowdown_normalTMlResID—Down arrow, normal state.
Scrollbar_arrowup_normalTMlResID—Up arrow, normal state.
Scrollbar_horz_bkgTMlResID—Horizontal scrollbar track background.
Scrollbar_horzbar_downTMlResID—Horizontal scrollbar thumb, pressed state.
Scrollbar_horzbar_highlightTMlResID—Horizontal scrollbar thumb, hot state.
Scrollbar_horzbar_normalTMlResID—Horizontal scrollbar thumb, normal state.
Scrollbar_arrowleft_normalTMlResID—Left arrow, normal state.
Scrollbar_arrowright_normalTMlResID—Right arrow, normal state.
Scrollbar_arrowdown_downTMlResID—Down arrow, pressed state.
Scrollbar_arrowdown_highlightTMlResID—Down arrow, hot state.
Scrollbar_arrowleft_downTMlResID—Left arrow, pressed state.
Scrollbar_arrowleft_highlightTMlResID—Left arrow, hot state.
Scrollbar_arrowright_downTMlResID—Right arrow, pressed state.
Scrollbar_arrowright_highlightTMlResID—Right arrow, hot state.
Scrollbar_arrowup_downTMlResID—Up arrow, pressed state.
Scrollbar_arrowup_highlightTMlResID—Up 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
OnChangeTNotifyEvent—Fires when the content changes.
OnLastChangeTNotifyEvent—Fires when scrolling reaches the end, which is a good place to load more content.
OnUpButtonClickTNotifyEvent—Fires when the up arrow is clicked.
OnDownButtonClickTNotifyEvent—Fires when the down arrow is clicked.
OnPageUpTNotifyEvent—Fires when the user pages up.
OnPageDownTNotifyEvent—Fires when the user pages down.
Properties of TMlSkinCustomControl 5
NameTypeDefaultDescription
AboutTMlAboutInfo—A 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
OnDPIChangedTMlDPIChangedEvent—Fires 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.
OnBackgroundChangingTMlBackgroundEvent—Fires just before the background changes, giving you a chance to adjust what is drawn.
OnBackgroundChangedTMlCustomDrawEvent—Fires after the background has been drawn, so you can paint on top of it.
OnVisibleChangedTNotifyEvent—Fires 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.