VB 传递整个控件数组的问题
我有一个IMAGE控件的数组现在我有一个字定义的方法:ImageCommandMove,第一个参数是控件数组之一的数组,第二个参数是整个数组.要求在我鼠标移动到IMAGE...
我有一个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 展开
,第一个参数是控件数组之一的数组,第二个参数是整个数组.要求在我鼠标移动到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 展开
1个回答
展开全部
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
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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询