VB 传递整个控件数组的问题

来源:百度知道 编辑:UC知道 时间:2024/09/28 10:52:47
我有一个IMAGE控件的数组 现在我有一个字定义的方法:ImageCommandMove
,第一个参数是控件数组之一的数组,第二个参数是整个数组.要求在我鼠标移动到IMAGE上对图片进行更换,我的程序如下:但是现在提示类型不匹配,缺少数组或用户定义类型,问题出在Call ImageCommandMove(ImageCommand(Index), ImageCommand)的第二个参数,请高手指点下,我不明白错在哪里了

Private Sub ImageCommand_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Call ImageCommandMove(ImageCommand(Index), ImageCommand)
End Sub

Private Sub Picture1_click()
Call aa
End Sub
Private Sub ImageCommandMove(ByRef img As Object, ByRef images() As Object)
Dim i As Integer
Dim j As Integer

For j = 0 To UBound(images) - 1
If images(i) = img Then
img.Picture = LoadPicture(App.Path & "\scro_" & i & "_on.jpg")
Else
images(i).Picture = LoadPicture(App.Path & "\scro_" & i & ".jpg")
End If
Next j
End Sub

Private Sub ImageCommandMove(ByRef img As Object, ByRef images As Object)
Dim i As Integer
Dim j As Integer

For j = 0 To images.count - 1
If images(i) = img Then
img.Picture = LoadPicture(App.Path & "\scro_" & i & "_on.jpg")
Else
images(i).Picture = LoadPicture(App.Path & "\scro_" & i & ".jpg")
End If
Next j
End Sub