第1个回答 2007-10-17
新建工程,一个按钮,一个label,一个timer
Private Sub Command1_Click()
If Command1.Caption = "开始" Then
Command1.Caption = "停止"
Else
Command1.Caption = "开始"
End If
Timer1.Enabled = Not Timer1.Enabled
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 10
Command1.Caption = "开始"
Label1.Caption = ""
Label1.AutoSize = True
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Time
Label1.Left = Label1.Left - 10
If Label1.Left + Label1.Width <= 0 Then Label1.Left = Me.Width
End Sub
第2个回答 2007-10-18
'最简单的答案在这里
dim n As Boolean
Dim Mywhere As Boolean
Private Sub Form_Load()
Timer1.Interval = 20
End Sub
Private Sub Timer1_Timer()
If n = False Then
Select Case Label1.Left
Case Is > 0
Label1.Left = Label1.Left - 50
Case Is <= 0
n = True
End Select
Else
Select Case Label1.Left
Case Is < Me.Width - Label1.Width
Label1.Left = Label1.Left + 50
Case Is >= Me.Width - Label1.Width
n = False
End Select
End If
End Sub