unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    ColorProgressBar1: TColorProgressBar;
    ScrollBar1: TScrollBar;
    procedure ColorProgressBar1PositionChanged(Sender: TObject);
    procedure ScrollBar1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ScrollBar1Change(Sender: TObject);
begin
ColorProgressBar1.Position:=ScrollBar1.Position;
end;

procedure TForm1.ColorProgressBar1PositionChanged(Sender: TObject);
const
  poziomNiski=30;
  poziomWysoki=60;
begin
Caption:=IntToStr(ColorProgressBar1.Position);

if ColorProgressBar1.Position<poziomNiski then
  begin
  ColorProgressBar1.ColorBegin:=clMaroon;
  ColorProgressBar1.ColorEnd:=clRed;
  end;
if (ColorProgressBar1.Position>=poziomNiski) and (ColorProgressBar1.Position<poziomWysoki) then
  begin
  ColorProgressBar1.ColorBegin:=clOlive;
  ColorProgressBar1.ColorEnd:=clYellow;
  end;
if ColorProgressBar1.Position>=poziomWysoki then
  begin
  ColorProgressBar1.ColorBegin:=clGreen;
  ColorProgressBar1.ColorEnd:=clLime;
  end;
end;

end.
