VB中连图成动

来源:百度知道 编辑:UC知道 时间:2024/05/24 16:18:25
我有若干张连续图片
想在一个图画框中形成循环动画
同时不出现原图的空白区
请高手指点
望加上中文注解
Dim time As Single
Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
time = 0
Timer1.Enabled = True
Timer1.Interval = 1000

End Sub

Private Sub Timer1_Timer()
time = 0
time = time + 1
Select Case time
Case 1
PictureBox1.ImageLocation = "E:\\新建文件夹\_Bin\Sample4\StartBtnEffect.res\003.bmp"

Case 2
PictureBox1.ImageLocation = "E:\新建文件夹\_Bin\Sample4\StartBtnEffect.res\004.bmp"

Case 3
PictureBox1.ImageLocation = "E:\\新建文件夹\_Bin\Sample4\StartBtnEffect.res\005.bmp"

Case 4
PictureBox1.ImageLocation = "

Private Sub Timer1_Timer()
time = 0
time = time + 1

你每次都是先time =0 然后再time = time + 1
那这个time 就永远都是1啊

你得把这个time = 0 拿到其他过程中去赋值 并且定义为全局变量

或者直接这样写也行

Private Sub Timer1_Timer()
Static time
time = time + 1
Select Case time mod 5

下面的time = 0 也不要了.

即可

加我百度HI吧。

使用timer能做到
设定timer的interval

然后
dim y As Integer
y = y + 1: If y = 18 Then y = 0
Picture1.Picture = Image1(y).Picture '要设置相应的image1数组

www.btcoolman.com

傻的你,Timer=0要放到外面