Splash Screen Programatically in Delphi -
What's the best way to implement a splash screen in Delphi?
"itemprop =" text ">
Create a form, this is FormStyle
= fsStayOnTop
, this is the border style from anybody and it's title to empty. This will create a form that does not have a caption bar at the top. Drop a TImage
on the form and load your bitmap into it.
(A TTimer drop on the form will be used to make sure the splash screen remains at least some duration
here is the code I as your splash:
TSplashForm = class (TForm) Image1 :. TImage; CloseTimer: TTimer; process CloseTimerTimer (sender: TObject); procedure FormCreate (sender: TObject); procedure FormClose (From: TOBject; Action on: TCloseAction;) Process FormDestroy (Sender: TObject); Personal FStartTicks: Integer; FOKToClose: Boolean; Public Property OKToClo se: Boolean FOKToClose read about FOKToClose; end; var SplashForm: TSplashForm;
In FormCreate:
process TSplashForm.FormCreate (Sender: TObject ); start FStartTicks: = GetTickCount; end; procedure TSplashForm.CloseTimerTimer (sender: TObject); constant CTimeout = 3000; started, so (GetTickCount - FStartTicks & gt; CTimeout) and OKToClose closed; end; procedure TSplashForm.FormClose (From: Tubact; Var Action: TCloseAction); Start the action: = caFree; End; Process TSplashForm.FormDestroy (Sender: TObject); Start SplashForm: = Zero; End;
Some of your project file, do:
start SplashForm: = TSplashForm.Create (zero) application. Start; Application.Title: = 'My program'; // Create your form, start database connection etc. application. CreateForm (TForm1, Form1); If SplashForm is then SplashForm.OkToClose: = True; Application.Run; End.
(This code was written over the top of my head, it can not be compiled properly bat)
Comments
Post a Comment