Region
Namespace: System.Drawing
Assembly: System.Drawing.Managed (4.0.0.0)
Describes the interior of a graphics shape composed of rectangles and paths. This class cannot be inherited.
- C#
- VB.NET
public class Region : MarshalByRefObject, IDisposable
Public Class Region
Inherits MarshalByRefObject
Implements IDisposable
Constructors
Region()
Initializes a new instance of the Region class.
This constructor initializes a new Region with an infinite interior.
Region(path)
Initializes a new instance of the Region class.
| Name | Type | Description |
|---|---|---|
| path | GraphicsPath | A GraphicsPath that defines the new Region. |
Region(rect)
Initializes a new instance of the Region class.
Region(rect)
Initializes a new instance of the Region class.
| Name | Type | Description |
|---|---|---|
| rect | RectangleF | A RectangleF structure that defines the interior of the new Region. |
Methods
Clone()
Creates an exact copy of this Region.
Returns: Region. The Region that this method creates.
Complement(region)
Updates this Region to contain the portion of the specified Region that does not intersect with this Region.
Throws:
- ArgumentNullException region is .
Complement(rect)
Updates this Region to contain the portion of the specified RectangleF structure that does not intersect with this Region.
| Parameter | Type | Description |
|---|---|---|
| rect | RectangleF | The RectangleF structure to complement this Region. |
Complement(path)
Updates this Region to contain the portion of the specified GraphicsPath that does not intersect with this Region.
| Parameter | Type | Description |
|---|---|---|
| path | GraphicsPath | The GraphicsPath to complement this Region. |
Throws:
- ArgumentNullException path is .
Complement(rect)
Updates this Region to contain the portion of the specified Rectangle structure that does not intersect with this Region.
Dispose()
Exclude(region)
Updates this Region to contain only the portion of its interior that does not intersect with the specified Region.
Throws:
- ArgumentNullException region is .
Exclude(path)
Updates this Region to contain only the portion of its interior that does not intersect with the specified GraphicsPath.
| Parameter | Type | Description |
|---|---|---|
| path | GraphicsPath | The GraphicsPath to exclude from this Region. |
Throws:
- ArgumentNullException path is .
Exclude(rect)
Updates this Region to contain only the portion of its interior that does not intersect with the specified RectangleF structure.
| Parameter | Type | Description |
|---|---|---|
| rect | RectangleF | The RectangleF structure to exclude from this Region. |
Exclude(rect)
Updates this Region to contain only the portion of its interior that does not intersect with the specified Rectangle structure.
Finalize()
Finalizes an instance of the Region class.
GetBounds(g)
Gets a RectangleF structure that represents a rectangle that bounds this Region on the drawing surface of a Graphics object.
Returns: RectangleF. A RectangleF structure that represents the bounding rectangle for this Region on the specified drawing surface.
Throws:
- ArgumentNullException g is .
GetRegionScans(matrix)
Returns an array of RectangleF structures that approximate this Region after the specified matrix transformation is applied.
| Parameter | Type | Description |
|---|---|---|
| matrix | Matrix | A Matrix that represents a geometric transformation to apply to the region. |
Returns: RectangleF[]. An array of RectangleF structures that approximate this Region after the specified matrix transformation is applied.
Throws:
- ArgumentNullException matrix is .
Intersect(path)
Updates this Region to the intersection of itself with the specified GraphicsPath.
| Parameter | Type | Description |
|---|---|---|
| path | GraphicsPath | The GraphicsPath to intersect with this Region. |
Intersect(rect)
Updates this Region to the intersection of itself with the specified Rectangle structure.
Intersect(rect)
Updates this Region to the intersection of itself with the specified RectangleF structure.
| Parameter | Type | Description |
|---|---|---|
| rect | RectangleF | The RectangleF structure to intersect with this Region. |
Intersect(region)
Updates this Region to the intersection of itself with the specified Region.
IsEmpty(g)
Tests whether this Region has an empty interior on the specified drawing surface.
Returns: Boolean. if the interior of this Region is empty when the transformation associated with g is applied; otherwise, .
Throws:
- ArgumentNullException g is .
IsInfinite(g)
Tests whether this Region has an infinite interior on the specified drawing surface.
Returns: Boolean. if the interior of this Region is infinite when the transformation associated with g is applied; otherwise, .
Throws:
- ArgumentNullException g is .
IsVisible(x, y)
Tests whether the specified point is contained within this Region.
| Parameter | Type | Description |
|---|---|---|
| x | Single | The x-coordinate of the point to test. |
| y | Single | The y-coordinate of the point to test. |
Returns: Boolean. when the specified point is contained within this Region; otherwise, .
IsVisible(point)
Tests whether the specified PointF structure is contained within this Region.
Returns: Boolean. when the specified point is contained within this Region; otherwise, .
IsVisible(x, y, g)
Tests whether the specified point is contained within this Region when drawn using the specified Graphics.
| Parameter | Type | Description |
|---|---|---|
| x | Single | The x-coordinate of the point to test. |
| y | Single | The y-coordinate of the point to test. |
| g | Graphics | A Graphics that represents a graphics context. |
Returns: Boolean. when the specified point is contained within this Region; otherwise, .
IsVisible(point, g)
Tests whether the specified PointF structure is contained within this Region when drawn using the specified Graphics.
| Parameter | Type | Description |
|---|---|---|
| point | PointF | The PointF structure to test. |
| g | Graphics | A Graphics that represents a graphics context. |
Returns: Boolean. when point is contained within this Region; otherwise, .
IsVisible(x, y, width, height)
Tests whether any portion of the specified rectangle is contained within this Region.
| Parameter | Type | Description |
|---|---|---|
| x | Single | The x-coordinate of the upper-left corner of the rectangle to test. |
| y | Single | The y-coordinate of the upper-left corner of the rectangle to test. |
| width | Single | The width of the rectangle to test. |
| height | Single | The height of the rectangle to test. |
Returns: Boolean. when any portion of the specified rectangle is contained within this Region object; otherwise, .
IsVisible(rect)
Tests whether any portion of the specified RectangleF structure is contained within this Region.
| Parameter | Type | Description |
|---|---|---|
| rect | RectangleF | The RectangleF structure to test. |
Returns: Boolean. when any portion of rect is contained within this Region; otherwise, .
IsVisible(x, y, width, height, g)
Tests whether any portion of the specified rectangle is contained within this Region when drawn using the specified Graphics.
| Parameter | Type | Description |
|---|---|---|
| x | Single | The x-coordinate of the upper-left corner of the rectangle to test. |
| y | Single | The y-coordinate of the upper-left corner of the rectangle to test. |
| width | Single | The width of the rectangle to test. |
| height | Single | The height of the rectangle to test. |
| g | Graphics | A Graphics that represents a graphics context. |
Returns: Boolean. when any portion of the specified rectangle is contained within this Region; otherwise, .
IsVisible(rect, g)
Tests whether any portion of the specified RectangleF structure is contained within this Region when drawn using the specified Graphics.
| Parameter | Type | Description |
|---|---|---|
| rect | RectangleF | The RectangleF structure to test. |
| g | Graphics | A Graphics that represents a graphics context. |
Returns: Boolean. when rect is contained within this Region; otherwise, .
IsVisible(x, y, g)
Tests whether the specified point is contained within this Region object when drawn using the specified Graphics object.
| Parameter | Type | Description |
|---|---|---|
| x | Int32 | The x-coordinate of the point to test. |
| y | Int32 | The y-coordinate of the point to test. |
| g | Graphics | A Graphics that represents a graphics context. |
Returns: Boolean. when the specified point is contained within this Region; otherwise, .
IsVisible(point)
Tests whether the specified Point structure is contained within this Region.
Returns: Boolean. when point is contained within this Region; otherwise, .
IsVisible(point, g)
Tests whether the specified Point structure is contained within this Region when drawn using the specified Graphics.
| Parameter | Type | Description |
|---|---|---|
| point | Point | The Point structure to test. |
| g | Graphics | A Graphics that represents a graphics context. |
Returns: Boolean. when point is contained within this Region; otherwise, .
IsVisible(x, y, width, height)
Tests whether any portion of the specified rectangle is contained within this Region.
| Parameter | Type | Description |
|---|---|---|
| x | Int32 | The x-coordinate of the upper-left corner of the rectangle to test. |
| y | Int32 | The y-coordinate of the upper-left corner of the rectangle to test. |
| width | Int32 | The width of the rectangle to test. |
| height | Int32 | The height of the rectangle to test. |
Returns: Boolean. when any portion of the specified rectangle is contained within this Region; otherwise, .
IsVisible(rect)
Tests whether any portion of the specified Rectangle structure is contained within this Region.
Returns: Boolean. This method returns when any portion of rect is contained within this Region; otherwise, .
IsVisible(x, y, width, height, g)
Tests whether any portion of the specified rectangle is contained within this Region when drawn using the specified Graphics.
| Parameter | Type | Description |
|---|---|---|
| x | Int32 | The x-coordinate of the upper-left corner of the rectangle to test. |
| y | Int32 | The y-coordinate of the upper-left corner of the rectangle to test. |
| width | Int32 | The width of the rectangle to test. |
| height | Int32 | The height of the rectangle to test. |
| g | Graphics | A Graphics that represents a graphics context. |
Returns: Boolean. when any portion of the specified rectangle is contained within this Region; otherwise, .
IsVisible(rect, g)
Tests whether any portion of the specified Rectangle structure is contained within this Region when drawn using the specified Graphics.
| Parameter | Type | Description |
|---|---|---|
| rect | Rectangle | The Rectangle structure to test. |
| g | Graphics | A Graphics that represents a graphics context. |
Returns: Boolean. when any portion of the rect is contained within this Region; otherwise, .
MakeEmpty()
Initializes this Region to an empty interior.
MakeInfinite()
Initializes this Region object to an infinite interior.
Transform(matrix)
Transforms this Region by the specified Matrix.
Throws:
- ArgumentNullException matrix is .
Translate(dx, dy)
Offsets the coordinates of this Region by the specified amount.
| Parameter | Type | Description |
|---|---|---|
| dx | Int32 | The amount to offset this Region horizontally. |
| dy | Int32 | The amount to offset this Region vertically. |
Translate(dx, dy)
Offsets the coordinates of this Region by the specified amount.
| Parameter | Type | Description |
|---|---|---|
| dx | Single | The amount to offset this Region horizontally. |
| dy | Single | The amount to offset this Region vertically. |
Union(path)
Updates this Region to the union of itself and the specified GraphicsPath.
| Parameter | Type | Description |
|---|---|---|
| path | GraphicsPath | The GraphicsPath to unite with this Region. |
Throws:
- ArgumentNullException path is .
Union(rect)
Updates this Region to the union of itself and the specified Rectangle structure.
Union(rect)
Updates this Region to the union of itself and the specified RectangleF structure.
| Parameter | Type | Description |
|---|---|---|
| rect | RectangleF | The RectangleF structure to unite with this Region. |
Union(region)
Updates this Region to the union of itself and the specified Region.
Throws:
- ArgumentNullException region is .
Xor(path)
Updates this Region to the union minus the intersection of itself with the specified GraphicsPath.
| Parameter | Type | Description |
|---|---|---|
| path | GraphicsPath | The GraphicsPath to xor with this Region. |
Throws:
- ArgumentNullException path is .
Xor(rect)
Updates this Region to the union minus the intersection of itself with the specified Rectangle structure.
Xor(rect)
Updates this Region to the union minus the intersection of itself with the specified RectangleF structure.
| Parameter | Type | Description |
|---|---|---|
| rect | RectangleF | The RectangleF structure to Xor with this Region. |
Xor(region)
Updates this Region to the union minus the intersection of itself with the specified Region.
Throws:
- ArgumentNullException region is .