Back

Making a Splash Form



There are a few different ways to make a Splash Screen or Splash Form.
You can add a blinking loading label, and change the mouse cursor to a 'waiting' hour glass etc. while the splash form is shown.

Here is one way to make a splash form.

First you add a form to your current project, you can call it SplashForm if you wish.
Add a Timer to this spash form, double-click on the Timer then add 'Close', like this:

procedure TForm2.Timer1Timer(Sender: TObject);
begin
    Close;
end;

Then change the Timers Interval, in the Object Inspector, to 3000, this will give you a 3 second
delay, after the 3 seconds is up your splashform will close.

Click on the splashform and then change its BorderStyle to bsNone.
Then change its FormStyle to fsStayOnTop.
You can change the splashforms position in the Object Inspector so that it shows in the middle
of the screen, to do this change Position to poScreenCenter.

Add an Image to the splashform, double-click on the image to choose a picture.

Declare  this in your Private declarations:   Starting : Boolean;
Declare the name of your Splash Forms unit in your uses clause.

Add this code:

procedure TForm1.FormActivate(Sender: TObject);
begin
    if Starting then
     begin
         Starting := False;
         Form2.Show;
    end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
    Starting := True;
end;

You can add a panel under your splashform image to give it a border:
Change the Panels Align (in the Object Inspector) to:
Align := alClient;
Change the Panels PanelStyle next:
Panel1.PanelStyle := bsSingle;

Then any additional changes to the Panel to suit yourself.

To get the waiting hourglass, do this, change the splashforms Cursor to: crHourGlass.




Back