In C #, the transparent attribute change of Form is the gradient effect.

Source: Internet
Author: User

The progressive Effect of Form is mainly to use the Opacity attribute of Form and the Timer control. Opacity mainly refers to the Opacity of the Form. Its value ranges from 100% ~ 0%. It can be set to a double value. If it is set to 0.0, the Form is completely transparent. If it is set to 1.0, the Form is completely displayed. The Timer control is mainly used for timing. It has the Interval and Enabled attributes. Interval is used to set the Interval between two times. When Enabled is set to true, the Timer is available. Timer uses a Tick event to add code in it to describe the actions that should be performed along with timing. The specific code is as follows:
Show form gradually
1 this. Opacity = 0.0 // now Set Opacity to 0.0 in Form_Load, which is completely transparent
2 private void timereffectick (object sender, EventArgs e)
3 {
4 this. Opacity + = 0.01; // each time the Form's Opacity attribute is changed
5 if (this. Opacity> = 1.0) // when the Form is fully displayed, stop timing
6 {
7 this. timer1.Enabled = false;
8}
9}

If any of the above errors are found, please kindly advise. Thank you!

 

From warmth

Related Article

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.