Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Label Scroll effect

Im using a Label where text input from a text box is shown in that label. Now, I whant to make the label text scroll. I´ve looked around through the internet and I tried to write this into the code inside of the label:

private void label1_Click(object sender, EventArgs e)
{
    int Scroll;
    string strString = "This is scrollable text...This is scrollable text...This is scrollable text";

    Scroll = Scroll + 1;
    int iLmt = strString.Length - Scroll;
    if (iLmt < 20)
    {
        Scroll = 0;
    }
    string str = strString.Substring(Scroll, 20);
    label1.Text = str;
}

Does anybody see what Im doing wrong?

like image 203
Jessica Lopez Avatar asked Feb 18 '23 06:02

Jessica Lopez


1 Answers

//much easier:

private void timer2scroll_Tick(object sender, EventArgs e)
{
  label10Info.Text = label10Info.Text.Substring(1, label10Info.Text.Length - 1) + label10Info.Text.Substring(0,1);
}
like image 128
user4240660 Avatar answered Feb 21 '23 01:02

user4240660