在开发vb应用程序中,加入了动画之后可使软件具有生动活泼的效果,而且,在编写组态软件中,动画功能更是必不可少,如容器中容量的变化、液体液面的变化等,实际也是一种动画效果。在中科院空间中心开发的“电场和电导率监测网中心站专家系统”中,有多处使用动画效果,现简明介绍如下。
一、使用animation控件
在vb5.0中可以使用animation控件实现动画,实例如下:
| private sub animation1_click () with commondialog1 filter = "avi (*.avi)*.avi" '过滤器指定在对话框的文件列表框中显示文件的类型 .showopen 显示“打开”对话框 end with with animation1 .autoplay = true '一旦将 .avi 文件加载到 animation 控件中,则 .avi 文件 将连续循环的自动播放。 .open commondialog1.filename '打开一个将要播放的 .avi 文件。如果 autoplay 属性为 true,则只要加载该文件便可。 end with end sub |
| private sub form_load() with timer1 设定时器属性 .enabled = false .interval = 600 end with with anipushbutton1 '设anipushbutton1各属性 .enabled = true 激活 .cycle = 0 .caption = "" .pictdrawmode = 1 按图像的大小自动调整 .speed = 200 帧切换速度 .frame = 1 用loadpicture方法给picture属性赋值 .picture = loadpicture("c:\earth1.bmp ") .frame = 2 .picture = loadpicture("c:\earth2.bmp") .frame = 3 .picture = loadpicture("c:\earth3.bmp") .frame = 4 .picture = loadpicture("c:\earth4.bmp") .frame = 5 .picture = loadpicture("c:\earth5.bmp") end with end sub sub cmd_start_click () 开始命令按钮启动定时器 timer1.enabled = -1 end sub sub timer1_timer () anibutton1.specialop = 1 实现鼠标的click操作 end sub |
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器