C#如何将此代码从多行文本修改为从右到左移动的选框文本上的标签?

问题描述 投票:0回答:1

我制作了一个程序,文本从右向左移动(选框)。但是,我无法使用多行文字来标记。

谁能帮我?

单行文本是好的工作。但如果多行,只需得到最后一句话。

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;
    }
}
c# text timer marquee
1个回答
0
投票

尝试使用Environment.NewLine并附加到文本。

更好的方法是使用多行文本框并将其设置为只读。

© www.soinside.com 2019 - 2024. All rights reserved.