unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, ComCtrls;
type
TForm1 =
class(TForm)
ProgressBar1: TProgressBar;
// die alles anzeigt
ProgressBar2: TProgressBar;
// die einzelne Schritte anzeigt
Button1: TButton;
Timer1: TTimer;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
FileSize :
Array[0..3]
of Integer;
SizeAll : Integer;
CurrentFile : Byte;
Step : Integer;
Timer : TTimer;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i: Byte;
begin
FileSize[0]:=200000;
FileSize[1]:=10000;
FileSize[2]:=500000;
FileSize[3]:=30000;
SizeAll:=0;
for i:=0
to length(FileSize)
do
SizeAll := SizeAll + FileSize[i];
CurrentFile:=0;
Timer1.Interval:=50;
Timer1.Enabled:=true;
ProgressBar1.Max:=SizeAll;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
step:=5000;
Label1.Caption:='
File '+IntToStr(CurrentFile);
ProgressBar2.Max:=FileSize[CurrentFile];
ProgressBar2.Position:=ProgressBar2.Position + step;
ProgressBar1.Position:=ProgressBar1.Position + step;
If ProgressBar2.Position >= FileSize[CurrentFile]
then
begin
inc(CurrentFile);
ProgressBar2.Position:=0;
if CurrentFile > Length(FileSize)
then
Timer1.Enabled:=false;
end;
end;
end.