简体   繁体   中英

C# How to fix this code from multi-line text to label on marquee text moving right to left?

I made a program that text is moving right to left(marquee). But, I can't make use multi-line text to label.

Who can help me?

single line text is good work. But if multi-line, just get last sentence.

private void timer1_Tick(object sender, EventArgs e)
{
    string screentext = clsBas.SCREEN_TEXT;//include in Multi-line text;
    string[] result = screentext.Split(new string[] { "\r\n" }, StringSplitOptions.None);
    string space = "                          ";

    foreach (string news in result)
    {
       lblScreenText.Text = news + space;
       if (lblScreenText.Left < 0 && (Math.Abs(lblScreenText.Left) > 
lblScreenText.Width))
       lblScreenText.Left = lblScreenText.Width;
       lblScreenText.Left -= 2;
    }
}

Try using Environment.NewLine and append to text.

Better way to do it, is to use textbox multi-line and make it read-only.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM