关于VB控件数组的一点小问题
我的程序是有个picturebox控件数组为picture2(0)-picture2(15)...然后picturebox里面存放的是shape控件数组从shape28(...
我的程序是有个picturebox控件数组为picture2(0)-picture2(15)...然后picturebox里面存放的是shape控件数组从shape28(0)-shape28(15)。。。事件是点击任意一个。。。对picturebox的backcolor和bordercolor进行操作,同时shape控件的bordercolor也变色。。。只有点击的picturebox以及当中存放的shape变。。。求代码。。。最好能说明下
展开
1个回答
展开全部
看这个合不合你的意:
Private Sub Picture1_Click(Index As Integer)
Dim i As Integer
For i = 0 To Picture1.UBound
If i <> Index Then
Picture1(i).BorderStyle = 1
Picture1(i).BackColor = &H8000000F
Shape1(i).BorderColor = vbBlack
Else
Picture1(i).BorderStyle = 0
Picture1(i).BackColor = vbBlue
Shape1(i).BorderColor = vbRed
End If
Next i
End Sub
Private Sub Picture1_Click(Index As Integer)
Dim i As Integer
For i = 0 To Picture1.UBound
If i <> Index Then
Picture1(i).BorderStyle = 1
Picture1(i).BackColor = &H8000000F
Shape1(i).BorderColor = vbBlack
Else
Picture1(i).BorderStyle = 0
Picture1(i).BackColor = vbBlue
Shape1(i).BorderColor = vbRed
End If
Next i
End Sub
更多追问追答
追问
解释下啊。。。比如ubound是什么
追答
数组的最大值
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询