[英]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. 尝试使用Environment.NewLine并附加到文本。
Better way to do it, is to use textbox multi-line and make it read-only. 更好的方法是使用多行文本框并将其设置为只读。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.