控件: 图片框数组 Index:0-3 分别装入了图片
计时器:Timer1 属性 2000
代码如下:是对着书上抄的!
Dim i As Integer, sg As Integer
Private Sub Form_Load()
Dim j As Integer
For j = 0 To 3
Picture1(j).Left = 0
Picture1(j).Top = 0
Picture1(j).Height = Picture1(0).Height
Picture1(j).Width = Picture1(0).Width
Next j
Picture1(1).Visible = False
Picture1(2).Visible = False
Picture1(3).Visible = False
Picture1(0).Visible = True
Timer1.Enabled = True
sg = 0
End Sub
Private Sub Timer1_Timer()
Randomize '初始化随机函数
Picture1(sg).Visible = False '让当前显示的图片不可见
i = Int(Rnd * 4) '产生下一幅要显示图片的下标值
Picture1(i).Visible = True
sg = i '保留下在显示图片的下标值
End Sub
可运行后就是光显示picture1(0)的图片,不会显示其它的! 你们看看那里错了!给个解释,谢谢!