测试通过 Private Sub Command1_Click() If Timer1.Enabled = False Then Timer1.Enabled = True Else Timer1.Enabled = False End If End SubPrivate Sub Form_Load() Timer1.Interval = 500 Form1.Caption = Space(90) & "欢迎使用本系统" Form1.WindowState = 2 End SubPrivate Sub Timer1_Timer() Form1.Caption = Mid(Form1.Caption, 5, Len(Form1.Caption)) If Len(Form1.Caption) = 0 Then Form1.Caption = Space(90) & "欢迎使用本系统" End If End Sub
'简单例子 Dim i As Integer Dim strCaption As String Private Sub Command1_Click() Timer1.Enabled = True End SubPrivate Sub Form_Load() i = 0 Timer1.Enabled = False Timer1.Interval = 100 strCaption = Form1.Caption End SubPrivate Sub Timer1_Timer() i = i + 1 Dim j As Integer strspace = Space(i) Form1.Caption = strspace & Form1.Caption If i > 20 Then i = 0 Form1.Caption = strCaption End If End Sub
Dim num As Long Const x = "滚动的标题" Dim i As Long Private Sub Form_Load() Timer1.Interval = 100 num = (Me.Width - Me.TextWidth(x)) / Me.TextWidth(" ") i = num End SubPrivate Sub Timer1_Timer() i = i - 1 Me.Caption = String(i, " ") & x If i = 0 Then i = num End Sub
是caption改变吗?
Private Sub Command1_Click()
If Timer1.Enabled = False Then
Timer1.Enabled = True
Else
Timer1.Enabled = False
End If
End SubPrivate Sub Form_Load()
Timer1.Interval = 500
Form1.Caption = Space(90) & "欢迎使用本系统"
Form1.WindowState = 2
End SubPrivate Sub Timer1_Timer()
Form1.Caption = Mid(Form1.Caption, 5, Len(Form1.Caption))
If Len(Form1.Caption) = 0 Then
Form1.Caption = Space(90) & "欢迎使用本系统"
End If
End Sub
Dim i As Integer
Dim strCaption As String
Private Sub Command1_Click()
Timer1.Enabled = True
End SubPrivate Sub Form_Load()
i = 0
Timer1.Enabled = False
Timer1.Interval = 100
strCaption = Form1.Caption
End SubPrivate Sub Timer1_Timer()
i = i + 1
Dim j As Integer
strspace = Space(i)
Form1.Caption = strspace & Form1.Caption
If i > 20 Then
i = 0
Form1.Caption = strCaption
End If
End Sub
Const x = "滚动的标题"
Dim i As Long
Private Sub Form_Load()
Timer1.Interval = 100
num = (Me.Width - Me.TextWidth(x)) / Me.TextWidth(" ")
i = num
End SubPrivate Sub Timer1_Timer()
i = i - 1
Me.Caption = String(i, " ") & x
If i = 0 Then i = num
End Sub