一个VB控件数组的问题
请教一个VB问题:我在窗体上创建一个shape,name属性为c然后创建控件数组,100个shape,我想让用户点击shape控件,这个shape控件的shape属性就变...
请教一个VB问题:我在窗体上创建一个shape,name属性为c
然后创建控件数组,100个shape,
我想让用户点击shape控件,这个shape控件的shape属性就变为3,但是shape没有事件,我于是用窗体的mousedown事件,代码如下Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
For i = 0 To 99
If C(i).Left < X < C(i).Left + 495 And C(i).Top < Y < C(i).Top + 495 Then
C(i).Shape = 3
End If
Next i
End Sub
可是这样一来就全部变成了圆形,我该怎么办?
新手问问题,请赐教 展开
然后创建控件数组,100个shape,
我想让用户点击shape控件,这个shape控件的shape属性就变为3,但是shape没有事件,我于是用窗体的mousedown事件,代码如下Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
For i = 0 To 99
If C(i).Left < X < C(i).Left + 495 And C(i).Top < Y < C(i).Top + 495 Then
C(i).Shape = 3
End If
Next i
End Sub
可是这样一来就全部变成了圆形,我该怎么办?
新手问问题,请赐教 展开
展开全部
vb里没有类似a<x<b的判断方式,如果要用请用a<x and x<b
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
For i = 0 To 99
If C(i).Left < X And X < C(i).Left + C(i).Width And C(i).Top < Y And Y < C(i).Top + C(i).Height Then
C(i).Shape = 3
End If
Next i
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
For i = 0 To 99
If C(i).Left < X And X < C(i).Left + C(i).Width And C(i).Top < Y And Y < C(i).Top + C(i).Height Then
C(i).Shape = 3
End If
Next i
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询