C#: scrolling display of text in Winform form

To achieve scrolling text display, you first need to write the text into the Label control, and change the position of the Label control to achieve the position transformation of the text.

1. Add Timer and Lable controls to the form

2. Write the code

//滚动 Lable 
        private void timer1_Tick(object sender, EventArgs e)
        {
            //向左滚动
            label3.Left -= 2;
            //如果标签最右侧超出窗体,则标签从窗体左侧出现
            if (label3.Right < 0)
            {
                label3.Left = this.Width;
            }
        }

3. The Interval property of the Timer control can change the scrolling speed.

Guess you like

Origin blog.csdn.net/weixin_44690047/article/details/112857367