--> Tricks to make the splash screen for your application with delphi | Delphi Tips Trick

For Newbie

Tuesday, 15 November 2011

Tricks to make the splash screen for your application with delphi

| Tuesday, 15 November 2011



Tricks to make the splash screen for your application.

Form design:

     Add a new form (this form will be the splash screen) with the name of the unit: unit2 and formnya name is Form2 (in this example are the main form is Form1).
     Add TTimer component (Timer1) on Form2 earlier. Set the desired interval. Suppose that the timer interval = 5000, then the splash screen is displayed for 5 seconds until the main form is displayed.
     Set the splash screen form design according to individual taste.


Edit OnCreate event and Timer1 onTimer Form2:
TForm2.FormCreate procedure (Sender: TObject);
begin
   / / Automatic form resizing, according to W and H image1
   Width: = Image1.Width;
   Height: = Image1.Height;
   Screen.Cursor: = crHourGlass;
end;

TForm2.Timer1Timer procedure (Sender: TObject);
begin
   Timer1.Enabled: = False;
end;
The last step, edit your source project (Project menu - View Source):
program Project1;

uses
   Forms,
   Unit1 in 'Unit1.pas' {Form1},
   Unit2 in 'Unit2.pas' {Form2};

{$ R *. res}

begin
   with TForm2.Create (Application) do
   begin
     try
       Show;
       Application.Initialize;
       while Timer1.Enabled do Application.ProcessMessages;
     finally
       free;
     end;
   end;
   Application.CreateForm (TForm1, Form1);
   Application.Run;
end.

this is the application for splash delphi

Related Posts

No comments: