Teach you how to use C # As a splash (enable the screen)

Source: Internet
Author: User

Now there are some splash practices. I am relatively simple, and if your materials are good, you should be able to make good results. This tutorial does not rely on any third-party controls, use vs directly. The following is a preview image:

Body start:

First, create a winform project, and the form1.cs will not move. First, create a Windows window namedSplash, Set the form attributes as follows:

Showintaskbar= False: because it is a splash window, it does not need to be displayed on the taskbar. Then dragProgressbarAndTimerControls to the Splash window, as shown in.

Startposition = centerscreen;

Transparencykey= Black;

Formborderstyle= None: I have not seen any function keys in the Splash window.

Okay,Now let's go back to the form1 window., InInitializecomponentThe following code is added to this method:

Code
Thread th = new thread (New threadstart (dosplash ));
Th. Start ();
Thread. Sleep (3000 );
Th. Abort ();
Thread. Sleep (1000 );

Here we have created a new thread to start the dosplash method (mentioned later), and then told him that it should be started for 3 seconds (3000 Ms = 3 S) and then exited, set aside one second to close the program.

Then let's take a look at what the dosplash method has done. First, we add this method in form1:

Dosplash
Private void dosplash ()
{
Splash sp = new splash ();
Sp. showdialog ();
}

Simple: instantiate the Splash window.

Next, we start to set the Splash window. First, setIntervalThe property is1000, SsbarStep1,Maximum3. Now, double-click the Splash window to write the following code to its form_load:

Formload
Timer1.enabled = true;

The Tick Event code for timer1 is as follows:

Tick
Private void timereffectick (Object sender, eventargs E)
{
If (progressbarx1.value <progressbarx1.maximum)
{
Progressbarx1.step = 1;
Progressbarx1.performstep ();
}
}

So far, a simple Splash window is ready, isn't it easy?

Http://www.cnblogs.com/longqi293/archive/2009/01/16/1377345.html

Author: Jack fan (Beginner's blog of. Net CF/. Net)
Source: http://longqi293.cnblogs.com
You are welcome to browse and repost this blog post, but this statement must be retained without the author's consent, and the original article connection is clearly provided on the article page. In the reference article, I will indicate the source of the reference article and respect the copyright of others. If you find that I infringe your copyright, please contact me in time.
For more articles, see [stick] index stickers-mobile development (continuously updating)

Now there are some splash practices. I am relatively simple, and if your materials are good, you should be able to make good results. This tutorial does not rely on any third-party controls, use vs directly. The following is a preview image:

Body start:

First, create a winform project, and the form1.cs will not move. First, create a Windows window namedSplash, Set the form attributes as follows:

Showintaskbar= False: because it is a splash window, it does not need to be displayed on the taskbar. Then dragProgressbarAndTimerControls to the Splash window, as shown in.

Startposition = centerscreen;

Transparencykey= Black;

Formborderstyle= None: I have not seen any function keys in the Splash window.

Okay,Now let's go back to the form1 window., InInitializecomponentThe following code is added to this method:

Code
Thread th = new thread (New threadstart (dosplash ));
Th. Start ();
Thread. Sleep (3000 );
Th. Abort ();
Thread. Sleep (1000 );

Here we have created a new thread to start the dosplash method (mentioned later), and then told him that it should be started for 3 seconds (3000 Ms = 3 S) and then exited, set aside one second to close the program.

Then let's take a look at what the dosplash method has done. First, we add this method in form1:

Dosplash
Private void dosplash ()
{
Splash sp = new splash ();
Sp. showdialog ();
}

Simple: instantiate the Splash window.

Next, we start to set the Splash window. First, setIntervalThe property is1000, SsbarStep1,Maximum3. Now, double-click the Splash window to write the following code to its form_load:

Formload
Timer1.enabled = true;

The Tick Event code for timer1 is as follows:

Tick
Private void timereffectick (Object sender, eventargs E)
{
If (progressbarx1.value <progressbarx1.maximum)
{
Progressbarx1.step = 1;
Progressbarx1.performstep ();
}
}

So far, a simple Splash window is ready, isn't it easy?

Http://www.cnblogs.com/longqi293/archive/2009/01/16/1377345.html

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.