TMlSkinProgressBar

A progress bar drawn from images for the track and the filled part, which allows very different visual styles.

Category
Progress & gauges
Unit
uMlSkinProgressBar.pas
Inherits from
TMlSkinCustomControl

Notes

  • Value reads and writes the progress within MinValueMaxValue, firing OnChanged when it moves.
  • Bar_Background is the track image and Bar_Progress the filled part.
  • BarLeftRightSize keeps that many pixels at each end unstretched, so rounded caps keep their shape.
  • TrackButton adds a draggable thumb, turning the bar into a playback slider.

Example

From the demo MlSkin.MainDemo.v3.0 (.dfm form file)

object grsProgressBar: TMlSkinProgressBar
  Left = 97
  Top = 394
  Width = 197
  Height = 17
  Caption.Font.Charset = DEFAULT_CHARSET
  Caption.Font.Color = clWindowText
  Caption.Font.Height = -11
  Caption.Font.Name = 'Tahoma'
  Caption.Font.Style = []
  Bar_Progress = '.\Res\bb2.png'
  Bar_Background = '.\Res\bb1.png'
  TrackButton.Normal = '.\Res\tb1.png'
  TrackButton.Hot = '.\Res\tb2.png'
  TrackButton.Visible = True
  MaxValue = 255
  Value = 192
  OnChanged = grsProgressBarChanged
end

Properties 8

NameTypeDefaultDescription
CaptionTMlCaptionThe text shown on the control.
Bar_ProgressTMlResIDImage used for the filled part of the bar.
Bar_BackgroundTMlResIDImage used for the bar's track.
BarLeftRightSizeInteger6How many pixels at each end of the image stay unstretched, so rounded caps keep their shape.
TrackButtonTMlPBTrackButtonThe thumb on the bar: its image, size and visibility. When shown it can be dragged, which turns the bar into a playback slider.
MinValueInteger0Lowest value allowed.
MaxValueInteger100Highest value allowed.
ValueInteger50The current progress within MinValueMaxValue.

Events 1

NameTypeDefaultDescription
OnChangedTNotifyEventFires after the state or value has changed.
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.