VB.net标签带有从左到右的滑动文本

时间:2019-03-06 18:57:29

标签: vb.net text label

我想在标签中显示的文本很长,因此我考虑过使文本在标签内从左到右滑动。

在VB.net中可以吗?

1 个答案:

答案 0 :(得分:0)

您可以;

Public Class Form1

    Dim BigStr As String = "         this is a very big string, and I want to slide it ya ya ya          "
    Dim Pointer As Integer = 0

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Label1.Text = BigStr.Substring(Pointer, 5)
        Pointer = Pointer + 1
        Pointer = Pointer Mod (BigStr.Length - 6)
    End Sub
End Class

别忘了启用计时器