关于VB的一个问题!一小时在先等!

来源:百度知道 编辑:UC知道 时间:2024/06/25 18:59:30
让一行欢迎词从窗体的左侧逐渐向右移,当全部移出窗体右侧后,又从窗体左侧开始移动,直到按下某按钮后停止移动。

加我百度HI

添加timer label command三个控件 代码如下

Private Sub Command1_Click()
Timer1.Interval = 0
End Sub

Private Sub Form_Load()
Timer1.Interval = 500
End Sub

Private Sub Timer1_Timer()
If Label1.Left < Me.Width Then
Label1.Left = Label1.Left + 500
Else
Label1.Left = 0 - Label1.Width
End If
End Sub

Private Sub Command1_Click()
If Command1.Caption = "停止移动" Then
Timer1.Enabled = False
Command1.Caption = "开始移动"
Else
Timer1.Enabled = True
Command1.Caption = "停止移动"
End If
End Sub

Private Sub Form_Load()
With Label1
.Caption = "石油大学欢迎你" & "!"
.AutoSize = True
.ForeColor = &HFF&
.Left = 0
End With
Command1.Caption = "停止移动"
Timer1.Interval = 100
End Sub

Private Sub Timer1_Timer()
Label1.Left = Label1.Left + 100
If Label1.Left &