[英]C# How to fix this code from multi-line text to label on marquee text moving right to left?
我制作了一个程序,文本从右向左移动(选框)。 但是,我无法使用多行文字来标记。
谁能帮我?
单行文本是好的工作。 但如果多行,只需得到最后一句话。
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;
}
}
尝试使用Environment.NewLine并附加到文本。
更好的方法是使用多行文本框并将其设置为只读。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.