This example uses two rectangles A and B to demonstrate the functions of each method of the System.Drawing.Region class.
Draw two rectangles
![](https://img.php.cn/upload/article/000/000/194/423f3a278e78eae77b48d8e86703c839-1.png)
Get the part of the target rectangle that does not intersect with this Region
Get the part of this Region that does not intersect with the target rectangle
![](https://img.php.cn/upload/article/000/000/194/6bdf3998808c6946b9a45cc836f23e62-3.png)
##Get the intersection of the two rectangles
![](https://img.php.cn/upload/article/000/000/194/6bdf3998808c6946b9a45cc836f23e62-4.png)
Get the union of two rectangles
![](https://img.php.cn/upload/article/000/000/194/f1e76ebbb0c298c1c31f37b6df6b4874-5.png)
Get the disjoint parts of the union of two rectangles
![](https://img.php.cn/upload/article/000/000/194/211705074a7f4e87fc3638dba6bb630e-6.png)
Initialize this System.Drawing.Region
![](https://img.php.cn/upload/article/000/000/194/34e5365150e30827a2f60e49390d64e6-7.png)
Display RegionData information
![](https://img.php.cn/upload/article/000/000/194/34e5365150e30827a2f60e49390d64e6-8.png)
The above is the detailed content of Method usage of C# System.Drawing.Region class (illustration). For more information, please follow other related articles on the PHP Chinese website!