[VB.net][VB6][VBA]最簡單的文字跑馬燈
如果不求很炫麗的效果,這段程式碼的寫法夠精簡了吧。
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = "最簡單的文字跑馬燈。。。。。"
Timer1.Interval = 500
Timer1.Enabled = True
End Sub
Function 文字旋轉(ByVal s As String, ByVal v As Integer) As String
'--- S=目標字串, V=捲動次數( +v 右捲, -v 左捲)---
文字旋轉 = Mid(s & s & s, Len(s) - (v Mod Len(s)) + 1, Len(s))
End Function
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = 文字旋轉(Label1.Text, -1)
End Sub
End Class
下載:文字跑馬燈.rar