Loading Screen

Hey,

How would I create a loading screen that fakes a load e.g
It shows a progress bar loading but Its not loading it just makes it look good ?

Cheers,

Computer Programer
computerprogramerAsked:
Who is Participating?
 
senadConnect With a Mentor Commented:
progress bar and a timer
0
 
senadCommented:
Here is the code :
(Put a progress bar and a timer on the form)


unit prog;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, ComCtrls;

type
  TForm1 = class(TForm)
    ProgressBar1: TProgressBar;
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  ProgressBar1.Position:=0;
  Timer1.Enabled := True;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  ProgressBar1.Visible:=True;
  Randomize;
  if Random(1) = 0 then ProgressBar1.Position:=ProgressBar1.Position+1;
  if (ProgressBar1.Position = 100) then
  begin

    Timer1.Enabled := False;
    ProgressBar1.Visible:=False;
    //MessageDlg('Progress Bar Finished',mtConfirmation,[MBOK],0);
    //Form1.Destroy;

 end;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  Close;
end;

end.
0
 
senadCommented:
so in progress barr increase the MAX if you want it to "play" longer ...
0
 
senadCommented:
example : set max to 300 (progresss bar)
and in above code
if (ProgressBar1.Position = 300) then..
0
All Courses

From novice to tech pro — start learning today.