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.