none
Collision Check on a picture box? RRS feed

  • Question

  • Title says it all pretty much, I want to check if one picture box is touching or IN another picture box, and I'm not to sure how to do it.
    Wednesday, April 29, 2009 3:40 AM

Answers

  •  Dim Rectangle1 As Rectangle = PictureBox1.Bounds
            Dim Rectangle2 As Rectangle = PictureBox2.Bounds
    
            If Rectangle1.IntersectsWith(Rectangle2) Then
                MessageBox.Show("Picturebox1 intersects with Picturebox2")
            End If

    Coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
    • Marked as answer by Sam V Wednesday, April 29, 2009 4:44 AM
    Wednesday, April 29, 2009 4:30 AM

All replies

  •  Dim Rectangle1 As Rectangle = PictureBox1.Bounds
            Dim Rectangle2 As Rectangle = PictureBox2.Bounds
    
            If Rectangle1.IntersectsWith(Rectangle2) Then
                MessageBox.Show("Picturebox1 intersects with Picturebox2")
            End If

    Coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
    • Marked as answer by Sam V Wednesday, April 29, 2009 4:44 AM
    Wednesday, April 29, 2009 4:30 AM
  • :O
    Ah, I should have looked through the methods/functions for Rectangles...
    Thank you, bdbodger :D
    Wednesday, April 29, 2009 4:39 AM