uses comctrls;
var
pgr: TProgressbar;
procedure TForm1.FormCreate(Sender: TObject);
begin
pgr := TProgressbar.create(self);
pgr.visible := false;
pgr.parent := Button1;
pgr.width := Button1.width - 8;
pgr.height := Button1.height - 8;
pgr.left := 4;
pgr.top := 4;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
pgr.free;
end;
procedure TForm1.doit;
var
i: integer;
begin
//--- mach was; z.B.-----------
pgr.max := 100;
for i := 1 to pgr.max do
begin
Sleep(50);
pgr.position := i;
Application.ProcessMessages;
end;
//-----------------------------
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Button1.Enabled := false;
pgr.Position := 0;
pgr.Visible := True;
Application.ProcessMessages;
doit;
pgr.Visible := False;
Button1.Enabled := true;
end;