你试试,源代码如下:
Public bz
Private Sub Form_Load()
Form_Resize
Command2.Caption = "暂停"
bz = 0
Timer1.Interval = 500
End Sub
Private Sub Form_Resize()
width1 = Form1.Width
hight1 = Form1.Height
Command1.Top = hight1 - 900
Command2.Top = hight1 - 900
Command3.Top = hight1 - 900
Command1.Left = 0
Command2.Left = Int(width1 / 3)
Command3.Left = Int(width1 / 3) * 2
Command1.Width = Int(width1 / 3)
Command2.Width = Int(width1 / 3)
Command3.Width = Int(width1 / 3)
Label1.Top = hight1 / 2 - 500
Label1.Left = width1 / 2 - 2000
End Sub
Private Sub Command1_Click()
Form_Resize
Timer1.Interval = 500
End Sub
Private Sub Command2_Click()
If Command2.Caption = "暂停" Then
Timer1.Interval = 0
Command2.Caption = "开始"
Else
Timer1.Interval = 500
Command2.Caption = "暂停"
End If
End Sub
Private Sub Command3_Click()
MsgBox "按确定退出", 0, ""
End
End Sub
Private Sub Timer1_Timer()
Select Case bz
Case 0:
Label1.ForeColor = vbRed
If Label1.Left + Label1.Width > Form1.Width Then
Label1.Left = 0
Else
Label1.Left = Label1.Left + 300
End If
bz = 1
Case 1:
Label1.ForeColor = vbBlue
If Label1.Left + Label1.Width > Form1.Width Then
Label1.Left = 0
Else
Label1.Left = Label1.Left + 300
End If
bz = 0
End Select
End Sub
[此贴子已经被作者于2017-11-29 20:06编辑过]