[英]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.