I have an outer rectangle and a rectangle inside. How can I return all remaining rectangle after cut of intersecting rectangle?
The natural way to represent this would be to use the Region
class, something like:
var result = new Region(outer);
result.Exclude(inner);
If you really want a list of Rectangle
structures, you can look at converting to RectangleF
s using GetRegionScans
using an identity matrix and then converting them to Rectangle
s using Ceiling
or Floor
.