Timer_animate.inteval=100 INTEVAL属性为100ms
Timer_animate.enabled=true 启动动画定时器
End Sub
Private Sub Timer_animate_Timer()
Call ani_Image 定时调移动子程序
End Sub
Sub IncrFrame()
FrameNum = FrameNum 1 帧加1
If FrameNum $#@62; 5 Then
最后一帧图像显示之后返回第一帧
FrameNum = 1
End If
Imageearth(0).Picture = Imageearth(FrameNum).Picture
将该帧图像赋给运动的Imageearth(0)控件的Picture属性
End Sub
Sub ani_Image() 控制移动子程序
Select Case Motion 控制移动方向的变量
Case 1 向上和向左移动,步长50 twips
Imageearth(0).Move Imageearth(0).
Left - 50, Imageearth(0).Top - 50
IncrFrame 切换到下一幅图
If Imageearth(0).Left $#@60; = 0 Then 向左移动到了边界
Motion = 2 向上和向右移动
ElseIf Imageearth(0).Top $#@60; = 0 Then
Motion = 4 向上移动到了边界,改向下和向左移动
End If
Case 2 向右和向上
Imageearth(0).Move Imageearth(0).Left 50,
Imageearth(0).Top - 50
IncrFrame
到了右边界,转为向左和向上
If Imageearth(0).Left $#@62;= (startform.Width
- Imageearth(0).Width) Then
Motion = 1
ElseIf Imageearth(0).Top $#@60; = 0 Then
Motion = 3 向右向下
End If
Case 3 向右向下
Imageearth(0).Move Imageearth(0).Left 50,
Imageearth(0).Top 50
IncrFrame
If Imageearth(0).Left $#@62;= (startform.Width
- Imageearth(0).Width) Then
Motion = 4 向左向下
ElseIf Imageearth(0).Top $#@62;=
(startform.Height - Imageearth(0).Height) - 680 Then
Motion = 2 向右向上,其中680 twips是标题和菜单的高度
End If
Case 4 向左向下
Imageearth(0).Move Imageearth(0).Left - 50,
Imageearth(0).Top 50
IncrFrame
If Imageearth(0).Left $#@60; = 0 Then
是否到了左边界,如到了转向右向下
Motion = 3
是否到了下边界
ElseIf Imageearth(0).Top $#@62;= (startform.Height
- Imageearth(0).Height) - 680 Then
Motion = 1 向左向上
End If
End Select
End Sub
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




