Hola
Este es un ejemplo de progressbar.
Código Delphi
[-]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, ComCtrls;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure DialogTimer(Sender: TObject) ;
private
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.DialogTimer(Sender: TObject) ;
var
aPB : TProgressBar;
begin
if NOT (Sender is TTimer) then Exit;
if ((Sender as TTimer).Owner) is TForm then
with ((Sender as TTimer).Owner) as TForm do
begin
aPB := TProgressBar(FindComponent('Progress')) ;
if aPB.Position >= aPB.Max then
ModalResult := mrCancel
else
aPB.StepIt;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
AMsgDialog : TForm;
AProgressBar : TProgressBar;
ATimer : TTimer;
begin
AMsgDialog := CreateMessageDialog('El Programa se esta cargando, Espere', mtWarning, []) ;
AProgressBar := TProgressBar.Create(AMsgDialog) ;
ATimer := TTimer.Create(AMsgDialog) ;
with AMsgDialog do
try
Tag := 5;
Caption := 'En Proceso, espere';
Height := 100;
with AProgressBar do begin
Name := 'Progress';
Parent := AMsgDialog;
Max := AMsgDialog.Tag;
Step := 1;
Top := 50;
Left := 8;
Width := AMsgDialog.ClientWidth - 16;
end;
with ATimer do
begin
Interval := 1000;
OnTimer:=DialogTimer;
end;
case ShowModal of
ID_CANCEL:
end;
finally
ATimer.OnTimer := nil;
Free;
end;
end;
end.
Saludos