Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Font = New Font("楷体", 28)
Label1.Text = "左移,左移"
Timer1.Interval = 100
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim myPoint As Point
myPoint = Label1.Location '获取标签当前位置
Label1.Location = New Point(myPoint.X - 20, myPoint.Y) '左移
If Label1.Location.X + Label1.Width > 0 Then '当标签的右边线还在窗体上
Label1.Location = New Point(myPoint.X - 20, myPoint.Y) '左移
Else '否则
myPoint = New Point(Me.Width, myPoint.Y) '右侧重新移入
Label1.Location = myPoint
End If
End Sub
End Class