The effect of a procedure animation that occurs before SplashScreen starts a program in WPF

Source: Internet
Author: User

Before you start the Windows desktop program, you will typically design a wait animation before you wait for the main program to run, and if the main program is up, the scene animation will disappear.

WFP provides this small and useful feature SplashScreen class

There are generally two ways to implement
1. Using the VS2008 tool, you can achieve
The first step is to choose a suitable picture bmp,jpg,gif. Add to your VS project.
The second right button this picture file Select "Properties",
Step three click on the "Build Action" drop-down box in the property to select "SplashScreen".

This enables the animation function of the process

2. The second way is the programming approach
The first step is still to select a picture to add to the project, add directly to the project under the line, as a normal file. (not necessarily added to the resource)
The second step is to instantiate the object
SplashScreen ss = new SplashScreen ("dsc_0036.jpg");/parameter is the name of the picture, note the path.
Ss.show (TRUE)//only if the Show method is called, the procedure animation is displayed, there is a bool type input parameter, and if true,
This scene animation will close itself when the main program is displayed, and if it is a false type, this animation is not closed,

Only explicit calls to the Close method
Ss. Close (new TimeSpan (0,0,10));//Here are the parameters TimeSpan is named how long after SS closes

The above code should be implemented in the protected override void Onstartup (StartupEventArgs e) in the App class

The closing effect is progressive

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.