VB 滚动字显示时间

来源:百度知道 编辑:UC知道 时间:2024/06/05 19:32:14
label1上显示当前日期和时间从右向左移动 可是一圈以后时间还是启动程序时候那个 不是系统同步的

Option Explicit
Dim Times As Single
Dim H As Single
Dim M As Single
Dim S As Single

Private Sub Form_Load()
Timer1_Timer
End Sub

Private Sub Timer1_Timer()
Times = Times + 1
H = Hour(Now): M = Minute(Now): S = Second(Now)
Label1.Caption = Format(H, "00") & ":" & Format(M, "00") & ":" & Format(S, "00")
Label1.Left = Label1.Left + 100
If Label1.Left > Me.ScaleWidth Then
Label1.Left = 0
End If
End Sub

在他的程序里面加个CALL Timer1_Timer应该就OK了