手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>网络编程>Asp.Net编程>列表

在VB应用软件中实现动画效果

来源:互联网 作者:西部数码 时间:2008-04-09
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!

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
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!