To make a splash scren the following way:
1. Create a main form first.
2. Add the form to be used as a splash screen (from the File menu, select New Form). Give it a name with FrmSplash form.
3. Add a timer component (located on the Win32 tab), give the name of the tmMainTimer.
4. Add the following code in onTimer events of the Timer component:
tmMainTimer.Enabled := False;
5. From the Project menu, select Options.
6. Move to the Forms tab.
7. From auto parts to create visible forms two forms. Select Form to be used as a splash screen and click the ">" to move the splash screen form to the Available forms.
8. If you already click OK.
9. Now from the View menu, select Project Source. In the main program make a splash screen form before initialization done.
For more details, see the following program snippet:
program Project1;
uses Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {FrmSplash};
{$R *.RES}
begin
FrmSplash := TFrmSplash.Create(Application);
FrmSplash.Show;
FrmSplash.Update;
while FrmSplash.tmMainTimer.Enabled do Application.ProcessMessages;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
FrmSplash.Hide;
FrmSplash.Free; // menghapus form splash scren dr memory
Application.Run;
end.
Tidak ada komentar:
Posting Komentar