unit ProportionalScrollBar;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TPsProportionalScrollBar = class(TScrollBar)
  private
    FPageSize: Integer;
  protected
    procedure SetPageSize(const NewPageSize: Integer);
  public
    procedure ClearPageSize;
  published
    property PageSize: Integer read FPageSize write SetPageSize;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Professional Software', [TPsProportionalScrollBar]);
end;

procedure TPsProportionalScrollBar.SetPageSize(const NewPageSize: Integer);
var
  ScrollInfo : TScrollInfo;
begin
  if FPageSize = NewPageSize then Exit;
  FPageSize := NewPageSize;
  ScrollInfo.cbSize := SizeOf(ScrollInfo);
  ScrollInfo.fMask := SIF_PAGE;
  ScrollInfo.nPage := NewPageSize;
  if HandleAllocated then SetScrollInfo(Handle, SB_CTL, ScrollInfo, True);
end;

procedure TPsProportionalScrollBar.ClearPageSize;
begin
  SetPageSize(0);
end;

end.
