3

I have two rectangles in a WPF application. How can I check whether the rectangles intersect or not?

Anshuman Jasrotia
  • 3,135
  • 8
  • 48
  • 81

3 Answers3

8
if (rectangle1.IntersectsWith(rectangle2))
{
   // Do something
}

Rect.IntersectWith

Steve
  • 2,950
  • 3
  • 21
  • 32
4

Rect.IntersectsWith might be what you're looking for?

SeeSharp
  • 2,760
  • 16
  • 15
0

try the IntersectsWith method.

Sayse
  • 42,633
  • 14
  • 77
  • 146