1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| Private Function VerifierSiShapeSel(X As Single, Y As Single) As Integer
Dim forme As Shape
Dim i As Integer
For i = 0 To Shape1.Count - 1
If (X >= Shape1(i).Left) _
And (X <= Shape1(i).Left + Shape1(i).Width) _
And (Y >= Shape1(i).Top) _
And (Y <= Shape1(i).Top + Shape1(i).Height) Then
Exit For
End If
Next i
If i = Shape1.Count Then
VerifierSiShapeSel = -1
Else
VerifierSiShapeSel = i
End If
End Function
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim indice As Integer
indice = VerifierSiShapeSel(X, Y)
If indice > -1 Then
Shape1(indice).BorderWidth = 2
' Debug.Print indice
End If
End Sub |
Partager