Dim rectangles as ArrayList()
Private Sub form_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
Dim rectangle as Rectangle
for each rectangle in rectangles You have to add rectangles
to the array list every time you draw one.
if rectangle.contains(e.Y,e.X) Then
MessageBox.show("You clicked on a rectangle")
end if
next
End Sub