C # achieve text animation effect

Source: Internet
Author: User

First, create a new windows application named movingword, generate the form form1 (Text animation), add a label control and two button controls for the form, a clock control timer, the text attribute of the lable1 control is set to "love you 10 thousand", as follows:

Next, add the corresponding code for the corresponding control. The complete code is as follows:

Using system;
Using system. Collections. Generic;
Using system. componentmodel;
Using system. Data;
Using system. drawing;
Using system. text;
Using system. Windows. forms;

Namespace text Animation
{
Public partial class form1: Form
{
Public form1 ()
{
Initializecomponent ();
}

Private void button#click (Object sender, eventargs E)
{
Timer1.start ();
}

Private void button2_click (Object sender, eventargs E)
{
Timer1.stop ();
}

Private void timereffectick (Object sender, eventargs E)
{
Label1.left-= 5;
If (label1.right <0)
{
Label1.left = width;
}
}
}
}
Program description:
In the timer1 event, this code moves the label control:
Label1.left-= 5;
If (label1.right <0)
{
Label1.left = width;
}
The play button and stop button control the trigger of the timer control.

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.