Table of Contents

TMS FNC Scroll Bar — Guides

Orientation

Set Kind at design time or runtime:

ScrollBar1.Kind := sbVertical;   // default
ScrollBar1.Kind := sbHorizontal;

Value range

ScrollBar1.Min := 0;
ScrollBar1.Max := 500;
ScrollBar1.PageSize := 50;  // thumb proportional size
ScrollBar1.Value := 0;

Reacting to changes

procedure TForm1.ScrollBar1ValueChanged(Sender: TObject; AValue: Double);
begin
  PaintBox1.ScrollTop := Round(AValue);
  PaintBox1.Repaint;
end;

Appearance

Customise the track and thumb through TTMSFNCScrollBarAppearance:

ScrollBar1.Appearance.ThumbFill.Color := $FF5080FF;
ScrollBar1.Appearance.TrackFill.Color := $FFDDDDDD;
ScrollBar1.Appearance.ThumbRounding := 4;

Keyboard support

When ScrollBar1 has focus:

Key Action
Arrow Up / Left Decrement by SmallChange
Arrow Down / Right Increment by SmallChange
Page Up Decrement by LargeChange
Page Down Increment by LargeChange
Home Jump to Min
End Jump to Max

See also