Friday, December 27, 2019
Creating a Splash Screen in Delphi Applications
The most basic splash screen is just an image, or more precisely, a form with an image, that appears in the center of the screen when the application is loading. Splash screens are hidden when the application is ready to be used. Below is more information on the different types of splash screens you may see, and why theyre useful, as well as steps for creating your own Delphi splash screen for your application. What Are Splash Screens Used For? There are several types of splash screens. The most common are start-up splash screens - the ones you see when an application is loading. These usually display the applications name, author, version, copyright, Ã¢â¬â¹an image, or some type of icon, that uniquely identifies it. If you are a shareware developer, you could use splash screens to remind users to register the program. These may pop up when the program first launches, to tell the user that they can register if they want special features or to get email updates for new releases. Some applications use splash screens to notify the user of the progress of a time-consuming process. If you look carefully, some really large programs use this type of splash screen when the program is loading background processes and dependencies.Ã The last thing you want is for your usersÃ to think that your program is deadÃ if some database task is performing.Ã Creating a Splash Screen Lets see how to create a simple start-up splash screen in a few steps: Add a new form to your project.Select New Form from the File menu in the Delphi IDE.Change the Name Property of the Form to something like SplashScreen.Change these Properties: BorderStyle to bsNone, Position to poScreenCenter.Customize your splash screen by adding components likeÃ labels, images, panels, etc.You could first add one TPanel component (Align: alClient)Ã and play around with BevelInner, BevelOuter, BevelWidth, BorderStyle, and BorderWidth properties to produce some eye-candy effects.Select Project from the Options menu and move the Form from the Auto-create listbox to Available Forms.Well create a form on the fly and then display it before the application is actually opened.Select Project Source from the View menu.You can also do this throughÃ Project View Source.Add the following code after the begin statement of the Project Source code (the .DPR file): Application.Initialize; //this line exists! SplashScreen : TSplashScreen.Create(nil) ; SplashScreen.Show; SplashScreen.Update; After the final Application.Create() and before theÃ Application.Run statement, add: SplashScreen.Hide; SplashScreen.Free; Thats it!Ã Now you can run the application. In this example, depending on the speed of your computer, you will barely see your new splash screen, but if you have more than one form in your project, the splash screen will certainly show up.For more information on making the splash screen stay a bit longer, read through the code in this Stack Overflow thread. Tip:Ã You can also make custom shaped Delphi forms.