Moving text example in C#
This is a example of creating moving text in C#.
In order to do the moving text, you just need timer and label controller/component .
By Mohd Zulkamal
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)
In order to do the moving text, you just need timer and label controller/component .
Steps by Step:
- Create one windows form project
- add one label in the form.
- copy and paste code below.
- Hit "CTRL + F5" and see what will happen.
The code :
public partial class Form1 : Form
{
private string[] words = new string[3];
private int i, j;
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
if(i.Equals(words[j].Length))
{
label1.Text = "";
if (j < words.Length - 1)
{
j = j + 1;
label1.Text = words[j];
}
else
{
j = 0;
}
i = 0;
}
label1.Text = words[j].Substring(0, i);
i = i + 1;
}
private void Form1_Load(object sender, EventArgs e)
{
words[0] = "www.developersnote.com";
words[1] = "www.developersnote.com";
words[2] = "www.developersnote.com";
timer1.Start();
}
}
By Mohd Zulkamal
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)