VB.net标签,从左到右滑动文本

问题描述 投票:1回答:1

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

这可能在VB.net中吗?

vb.net text label
1个回答
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

别忘了启用计时器

© www.soinside.com 2019 - 2024. All rights reserved.