The delphi production program will welcome the window

Source: Internet
Author: User

This is what I learned during my previous career design. I believe many beginners are looking for this information, here is a simple record for your reference:

Production Program animated window:

The name of your login window is loginform.
Find the Project file (Project-> View Source) and find the following generation parts:
Begin
Application. Initialize;

Application. CreateForm (TForm1, Form1 );
Application. CreateForm (Tloginform, loginform );

Application. Run; // at this point, the program runs
End.
You can set the login window to be created before the program production line:
Begin
Application. Initialize; // Initialization
Loginform: = tloginform. Create (application); // Create a dynamic window
Loginform. Show; // display
Loginform. Update;
Sleep (2000); // the delay of the system is 2 seconds.
Loginform. Hide; // Hide the dynamic window in 2 seconds
Application. CreateForm (TForm1, Form1 );
Application. CreateForm (Tloginform, loginform );
Loginform. Free; // release dynamic window
Application. Run;
End.

Another way to create an animated window... you have also used it ~~) :
Set the cover form attribute so that it meets the requirements for starting the cover. Modify the following cover form attributes:

Position = PoscreenCenter
// The runtime is in the center of the screen
Autosize = true
// Automatically adapt to the Image control to enable full display of the Image
BorderStyle = bsnone
// The Window does not have a title bar or a button for maximizing, minimizing, or closing, or a border.
Name = splashform

Program code parsing

Select the Project/View Scource command under the main menu to open the Project file of this Project. Modify the following code.

Program Project2;
Uses
Forms, Controls,
Unit1 in 'unit1. pa' {MainForm },
Unit2 in 'unit2. pa' {SplashForm };
{$ R *. res}
Begin
Application. Initialize;
SplashForm: = TSplashForm. Create (Application );
// Create a splash form
SplashForm. ShowModal;
// Display the splash form in the mode dialog box
If (SplashForm. ModalResult = mrOK) then
// If the scheduled time reaches or the image on the form is clicked
Begin
Application. Title: = 'test Splash form ';
// Set the application title
Application. CreateForm (TMainForm, MainForm );
// Automatically create the main form
SplashForm. Hide;
// Hide the start cover form
SplashForm. Release;
// Clear the cover form
Application. Run;
End;
End.

Then write the following Event code on the splash form.

Procedure TSplashForm. Timer1Timer (Sender: TObject );
Begin
SplashForm. ModalResult: = mrOK;
// The event handler after the scheduled time
End;

Procedure TSplashForm. Image1Click (Sender: TObject );
Begin
SplashForm. ModalResult: = mrOK;
// Click the event processing program of the splash form image. When a user wishes to manually upload the animated window, the user can enter the main window without waiting, this condition can be added.
End;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.