uses
Winapi.Windows,
Winapi.Messages,
System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.ComCtrls,
Vcl.ExtCtrls;
type
TForm1 =
class( TForm )
ProgressBar1: TProgressBar;
TrackBar1: TTrackBar;
ProgressTimer: TTimer;
procedure ProgressTimer_Timer( Sender: TObject );
procedure TrackBar1_Change( Sender: TObject );
private
FProgressPosition: Integer;
procedure SetProgressPosition(
const Value: Integer );
public
property ProgressPosition: Integer
read FProgressPosition
write SetProgressPosition;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ProgressTimer_Timer( Sender: TObject );
begin
if ProgressBar1.Position <= ProgressPosition
then
ProgressBar1.Position := ProgressPosition
else
ProgressBar1.Position := ProgressBar1.Position - 1;
end;
procedure TForm1.SetProgressPosition(
const Value: Integer );
begin
FProgressPosition := Value;
end;
procedure TForm1.TrackBar1_Change( Sender: TObject );
begin
ProgressPosition := TrackBar1.Position;
end;