vb.net - 带有从左到右滑动文本的 VB.net 标签
问题描述
我想在我的标签中显示的文本很长,因此我考虑让文本在标签内从左到右滑动。
这在 VB.net 中可行吗?
解决方案
你可以;
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
不要忘记启用您的计时器