Step 1: MasterProgramStart the main form (form1)
As follows:
Static class Program
{
/// <Summary>
/// Main entry point of the application.
/// </Summary>
[Stathread]
Static void main ()
{
Application. enablevisualstyles ();
Application. setcompatibletextrenderingdefault (false );
Application. Run (New form1 ());
}
}
Step 2: Start the welcome page (form2) in the _ load event in the main form (form1)
As follows:
Private void form1_load (Object sender, eventargs E)
{
// Start the form
Form2 mysplashform = new form2 ();
Mysplashform. showdialog ();
}
Step 3: control the display mode of the welcome interface on the welcome interface and use timer to control the disappear time of the welcome interface (in practice, the system usually disappears after reading the required configuration information)
As follows:
Private void form2_load (Object sender, eventargs E)
{
// Set the startup form
This. formborderstyle = formborderstyle. None;
This. backgroundimage = image. fromfile ("test.jpg ");
This. timer1.start ();
This. timer1.interval = 10000;
}
Private void timereffectick (Object sender, eventargs E)
{
// ...... Read the System Configuration
// Close the startup form
This. Close ();
}
Private void form2_formclosed (Object sender, formclosedeventargs E)
{
// Disable the timer
This. timer1.stop ();
}