using Label control to create looping marquee text in c# winform
- by hanmyint
I have been create Marquee text using Label control her is sample code
public partial class FrmMarqueeText : Form
{
private int xPos = 0, YPos = 0;
public FrmMarqueeText()
{
InitializeComponent();
}
private void FrmMarqueeText_Load(object sender, EventArgs e)
{
lblText.Text = "Hello this is marquee text";
xPos = lblText.Location.X;
YPos = lblText.Location.Y;
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (xPos == 0)
{
this.lblText.Location = new System.Drawing.Point(this.Width, YPos);
xPos = this.Width;
}
else
{
this.lblText.Location = new System.Drawing.Point(xPos, YPos);
xPos -= 2;
}
}
but when the first time was finished, it didn't continues work .Please help me!