Dim Imggif(3) As Image 声明数组Imggif().Picture = (LoadPicture(App.Path & "\auto\Test001.jpg"),LoadPicture(App.Path & "\auto\Test002.jpg"),LoadPicture(App.Path & "\auto\Test003.jpg")) 给数组赋值Gifpicture.Picture = Imggif(Currentgif).Picture
调用数组显示图片我想把三张图片放到一个Image数组里,但我这样放报错!
呵呵,我不知道怎么写,请教各位?
调用数组显示图片我想把三张图片放到一个Image数组里,但我这样放报错!
呵呵,我不知道怎么写,请教各位?
dim i as integerfor i=1 to 3
Imggif(i).Picture = LoadPicture(App.Path & "\auto\Test00" & i & ".jpg" '给数组赋值 next i
dim i as integerfor i=1 to 3
Imggif(i).Picture = LoadPicture(App.Path & "\auto\Test00" & i & ".jpg") '给数组赋值
next i
呵呵,不懂意思,C#都没这种报错的
Dim Currentgif As Integer '当前显示第几幅图片
Dim Imggif(13) As Image
Private Sub Form_Load()
Rotateflag = 1 '进入显示(时钟计数开始)
Currentgif = 0 '第一幅图片定位
ShowPicture
End SubPrivate Sub Timer1_Timer()
If Rotateflag = 1 Then '交替显示开始
Tmrtimer.Interval = 130 '130ms后显示下一幅
Gifpicture.Picture = Imggif(Currentgif).Picture '开始显示第一幅图片
'Debug.Print Currentgif
Currentgif = Currentgif + 1 '130ms后显示下一幅
If Currentgif = 14 Then '如果已显示了十四幅,则再从第一幅显示
Currentgif = 0
Tmrtimer.Interval = 1000 '1000ms后显示下一幅,因第十四帧为一秒
End If
End IfEnd SubPrivate Sub ShowPicture()
Dim i As Integer
For i = 1 To 13
Imggif(i).Picture = LoadPicture(App.Path & "\auto\Test00" & i & ".jpg")
Next i
End Sub
在窗体设计时,点Imggif,右键 复制 粘贴。选 是
再把2楼的代码复制过去。
就可以了。
不对吧
C#都是入门级的
'在窗体中放入一个timer控件和一个pictutre控件 和一个 imagelist控件
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 500
Gifpicture.AutoSize = TrueEnd SubPrivate Sub Timer1_Timer()
Static temp As Integer
Gifpicture.Picture = LoadPicture("")
temp = temp + 1
If temp > ImageList1.ListImages.Count Then temp = 1
Gifpicture.Picture = ImageList1.ListImages(temp).Picture
End SubVB中测试通过。
即无法
dim a as new Image
也无法
dim a as image
set a=new image
所以下面是无法赋值的,
如果要图片数组,
可以这样定义Dim Imggif(3) As StdPicture结合1楼的代码Dim Imggif(3) As StdPicture '声明数组
dim i as integerfor i=1 to 3
set Imggif(i)= LoadPicture(App.Path & "\auto\Test00" & i & ".jpg") '给数组赋值
next i
Imggif().Picture = (LoadPicture(App.Path & "\auto\Test001.jpg"),LoadPicture(App.Path & "\auto\Test002.jpg"),LoadPicture(App.Path & "\auto\Test003.jpg")) 给数组赋值 应该这样:
Private Sub Form_Load()
Dim Imggif(2) As Image '声明数组
Imggif(0).Picture = LoadPicture(App.Path & "\auto\Test001.jpg")
Imggif(1).Picture = LoadPicture(App.Path & "\auto\Test002.jpg")
Imggif(2).Picture = LoadPicture(App.Path & "\auto\Test003.jpg") ' 给数组赋值Gifpicture.Picture = Imggif(1).Picture
End Sub