Easy Way to Learn ASP.NET

GDI+ Tutorial

GDI+ Introduction
GDI+ Lines
GDI+ Rectangles
GDI+ Ellipses
GDI+ Arcs
GDI+ Polygons
GDI+ Cardinal Splines
GDI+ Bezier Splines
GDI+ Graphics Paths
GDI+ Brushes
GDI+ Regions
GDI+ Antialiasing
GDI+ Bitmaps
GDI+ Metafiles
GDI+ Transformations
GDI+ Text

Regions in GDI+

A region is a portion of the display area of an output device. You can construct a region from a rectangle or a path. You can also create complex regions by combining existing regions.

The following illustration shows two regions: one constructed from a rectangle, and the other constructed from an ellipse.

Regions 

The Region class provides the following methods for combining regions: Intersect , Union , Xor , Exclude , and Complement.


Intersection

The intersection of two regions is the set of all points belonging to both regions. The following illustration shows the intersection (violet color).

Intersection 

The following code example shows how to draw the intersection of two regions:

 


Union

The union is the set of all points belonging to one or the other or both regions. The following illustration shows the union.

Union 

The following code example demonstrates how to draw the union of two regions:

 


Complement

The complement of a region is the set of all points that are not in the region. The following illustration shows the complement (violet color).

Complement 

The following code example demonstrates how to draw the complement of a region:

 


Xor

Xor is a process to produce a region that contains all points that belong to one region or the other, but not both. The following illustration show the Xor region (violet color).

Xor 

The following code example demonstrates how to draw the Xor of region:

 


Exclude

Exclude is a process to produces a region that contains all points in the first region that are not in the second region. The following illustration shows the exclude region (violet color).

Exclude 

The following code example demonstrates how to exclude a region: