这个怎么做 VB题目

来源:百度知道 编辑:UC知道 时间:2024/06/13 23:01:13
单击Form2窗体中的"启动动画"按钮,北京奥运会中国印图形向右运动,当图片越出窗体,出现自右向左运动的文字"北京欢迎您",当文字越出窗体,再出现自左向右运动的北京奥运会中国印图形。

Dim a As Boolean, i As Integer

Private Sub Command1_Click()
Timer1.Enabled = True
End Sub

Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 200
Label1.Caption = "北京欢迎您"
Label1.Left = Me.Width
Picture1.Left = -Picture1.Width
End Sub

Private Sub Timer1_Timer()
i = i + 50
If a = False Then
Picture1.Left = Picture1.Left + i
Else
Label1.Left = Label1.Left - i
End If
If Picture1.Left >= Me.Width Then i = 0: a = True
End Sub