I am trying to determine which shape on my user control has been clicked. I have tried googling but everything seems to come up with VBA which doesnt seem to be easily adaptable to this.
I'm pretty sure I'm close but its either my definition for shp or the collection I'm looping through which is wrong.
Incidentally variable a is just so I can see where I'm at as I step through.
Thanks in advance
Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim shp As Shape
For Each shp In UserControl.shapes
a = shp.Name
If shp.Name = "shpWorkBlock" Then
If X >= shp.Left And X <= shp.Left + shp.Width And _
Y >= shp.Top And Y <= shp.Top + shp.Height Then
MsgBox shp.Index & " has been clicked."