文件名称:简单小动画
文件大小:799B
文件格式:VBP
更新时间:2016-01-21 13:47:05
陀螺
Option Explicit Dim imgIndex As Integer '标识当前显示的是第几个图像 ' 卸载窗体 Private Sub cmdClose_Click() Unload Me frmMain.Show End Sub '运行或停止演示 Private Sub cmdRun_Click() If Timer1.Enabled = False Then Timer1.Enabled = True cmdRun.Caption = "停止" Else Timer1.Enabled = False cmdRun.Caption = "运行" End If End Sub '加载窗体和图像 Private Sub Form_Load() Dim i As Integer '加载ImageList控件的图象 For i = 0 To 17 imgLst.ListImages.Add , , Image1(i).Picture Next i '设置初始图像索引 imgIndex = 0 End Sub '利用时钟实现动画 '循环显示图像 Private Sub Timer1_Timer() imgIndex = imgIndex + 1 If imgIndex > 18 Then imgIndex = 1 End If Dim picX As Picture Set picX = imgLst.ListImages(imgIndex).ExtractIcon Me.Icon = picX picMouse.MouseIcon = picX picMouse.MousePointer = vbCustom End Sub