Skip to main content

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.

public class Region : MarshalByRefObject, IDisposable

Constructors

Instance member Region()

Initializes a new instance of the Region class.

This constructor initializes a new Region with an infinite interior.

Instance member Region(path)

Initializes a new instance of the Region class.

NameTypeDescription
pathGraphicsPathA GraphicsPath that defines the new Region.

Instance member Region(rect)

Initializes a new instance of the Region class.

NameTypeDescription
rectRectangleA Rectangle structure that defines the interior of the new Region.

Instance member Region(rect)

Initializes a new instance of the Region class.

NameTypeDescription
rectRectangleFA RectangleF structure that defines the interior of the new Region.

Instance member Region(rgnData)

Initializes a new instance of the Region class.

NameTypeDescription
rgnDataRegionDataA RegionData that defines the interior of the new Region.

Methods

Instance member Clone()

Creates an exact copy of this Region.

Returns: Region. The Region that this method creates.

Instance member Complement(region)

Updates this Region to contain the portion of the specified Region that does not intersect with this Region.

ParameterTypeDescription
regionRegionThe Region object to complement this Region object.

Throws:

Instance member Complement(rect)

Updates this Region to contain the portion of the specified RectangleF structure that does not intersect with this Region.

ParameterTypeDescription
rectRectangleFThe RectangleF structure to complement this Region.

Instance member Complement(path)

Updates this Region to contain the portion of the specified GraphicsPath that does not intersect with this Region.

ParameterTypeDescription
pathGraphicsPathThe GraphicsPath to complement this Region.

Throws:

Instance member Complement(rect)

Updates this Region to contain the portion of the specified Rectangle structure that does not intersect with this Region.

ParameterTypeDescription
rectRectangleThe Rectangle structure to complement this Region.

Instance member Dispose()

Instance member Exclude(region)

Updates this Region to contain only the portion of its interior that does not intersect with the specified Region.

ParameterTypeDescription
regionRegionThe Region to exclude from this Region.

Throws:

Instance member Exclude(path)

Updates this Region to contain only the portion of its interior that does not intersect with the specified GraphicsPath.

ParameterTypeDescription
pathGraphicsPathThe GraphicsPath to exclude from this Region.

Throws:

Instance member Exclude(rect)

Updates this Region to contain only the portion of its interior that does not intersect with the specified RectangleF structure.

ParameterTypeDescription
rectRectangleFThe RectangleF structure to exclude from this Region.

Instance member Exclude(rect)

Updates this Region to contain only the portion of its interior that does not intersect with the specified Rectangle structure.

ParameterTypeDescription
rectRectangleThe Rectangle structure to exclude from this Region.

Protected member Finalize()

Finalizes an instance of the Region class.

Instance member GetBounds(g)

Gets a RectangleF structure that represents a rectangle that bounds this Region on the drawing surface of a Graphics object.

ParameterTypeDescription
gGraphicsThe Graphics on which this Region is drawn.

Returns: RectangleF. A RectangleF structure that represents the bounding rectangle for this Region on the specified drawing surface.

Throws:

Instance member GetRegionScans(matrix)

Returns an array of RectangleF structures that approximate this Region after the specified matrix transformation is applied.

ParameterTypeDescription
matrixMatrixA 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:

Instance member Intersect(path)

Updates this Region to the intersection of itself with the specified GraphicsPath.

ParameterTypeDescription
pathGraphicsPathThe GraphicsPath to intersect with this Region.

Instance member Intersect(rect)

Updates this Region to the intersection of itself with the specified Rectangle structure.

ParameterTypeDescription
rectRectangleThe Rectangle structure to intersect with this Region.

Instance member Intersect(rect)

Updates this Region to the intersection of itself with the specified RectangleF structure.

ParameterTypeDescription
rectRectangleFThe RectangleF structure to intersect with this Region.

Instance member Intersect(region)

Updates this Region to the intersection of itself with the specified Region.

ParameterTypeDescription
regionRegionThe Region to intersect with this Region.

Instance member IsEmpty(g)

Tests whether this Region has an empty interior on the specified drawing surface.

ParameterTypeDescription
gGraphicsA Graphics that represents a drawing surface.

Returns: Boolean. if the interior of this Region is empty when the transformation associated with g is applied; otherwise, .

Throws:

Instance member IsInfinite(g)

Tests whether this Region has an infinite interior on the specified drawing surface.

ParameterTypeDescription
gGraphicsA Graphics that represents a drawing surface.

Returns: Boolean. if the interior of this Region is infinite when the transformation associated with g is applied; otherwise, .

Throws:

Instance member IsVisible(x, y)

Tests whether the specified point is contained within this Region.

ParameterTypeDescription
xSingleThe x-coordinate of the point to test.
ySingleThe y-coordinate of the point to test.

Returns: Boolean. when the specified point is contained within this Region; otherwise, .

Instance member IsVisible(point)

Tests whether the specified PointF structure is contained within this Region.

ParameterTypeDescription
pointPointFThe PointF structure to test.

Returns: Boolean. when the specified point is contained within this Region; otherwise, .

Instance member IsVisible(x, y, g)

Tests whether the specified point is contained within this Region when drawn using the specified Graphics.

ParameterTypeDescription
xSingleThe x-coordinate of the point to test.
ySingleThe y-coordinate of the point to test.
gGraphicsA Graphics that represents a graphics context.

Returns: Boolean. when the specified point is contained within this Region; otherwise, .

Instance member IsVisible(point, g)

Tests whether the specified PointF structure is contained within this Region when drawn using the specified Graphics.

ParameterTypeDescription
pointPointFThe PointF structure to test.
gGraphicsA Graphics that represents a graphics context.

Returns: Boolean. when point is contained within this Region; otherwise, .

Instance member IsVisible(x, y, width, height)

Tests whether any portion of the specified rectangle is contained within this Region.

ParameterTypeDescription
xSingleThe x-coordinate of the upper-left corner of the rectangle to test.
ySingleThe y-coordinate of the upper-left corner of the rectangle to test.
widthSingleThe width of the rectangle to test.
heightSingleThe height of the rectangle to test.

Returns: Boolean. when any portion of the specified rectangle is contained within this Region object; otherwise, .

Instance member IsVisible(rect)

Tests whether any portion of the specified RectangleF structure is contained within this Region.

ParameterTypeDescription
rectRectangleFThe RectangleF structure to test.

Returns: Boolean. when any portion of rect is contained within this Region; otherwise, .

Instance member 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.

ParameterTypeDescription
xSingleThe x-coordinate of the upper-left corner of the rectangle to test.
ySingleThe y-coordinate of the upper-left corner of the rectangle to test.
widthSingleThe width of the rectangle to test.
heightSingleThe height of the rectangle to test.
gGraphicsA Graphics that represents a graphics context.

Returns: Boolean. when any portion of the specified rectangle is contained within this Region; otherwise, .

Instance member IsVisible(rect, g)

Tests whether any portion of the specified RectangleF structure is contained within this Region when drawn using the specified Graphics.

ParameterTypeDescription
rectRectangleFThe RectangleF structure to test.
gGraphicsA Graphics that represents a graphics context.

Returns: Boolean. when rect is contained within this Region; otherwise, .

Instance member IsVisible(x, y, g)

Tests whether the specified point is contained within this Region object when drawn using the specified Graphics object.

ParameterTypeDescription
xInt32The x-coordinate of the point to test.
yInt32The y-coordinate of the point to test.
gGraphicsA Graphics that represents a graphics context.

Returns: Boolean. when the specified point is contained within this Region; otherwise, .

Instance member IsVisible(point)

Tests whether the specified Point structure is contained within this Region.

ParameterTypeDescription
pointPointThe Point structure to test.

Returns: Boolean. when point is contained within this Region; otherwise, .

Instance member IsVisible(point, g)

Tests whether the specified Point structure is contained within this Region when drawn using the specified Graphics.

ParameterTypeDescription
pointPointThe Point structure to test.
gGraphicsA Graphics that represents a graphics context.

Returns: Boolean. when point is contained within this Region; otherwise, .

Instance member IsVisible(x, y, width, height)

Tests whether any portion of the specified rectangle is contained within this Region.

ParameterTypeDescription
xInt32The x-coordinate of the upper-left corner of the rectangle to test.
yInt32The y-coordinate of the upper-left corner of the rectangle to test.
widthInt32The width of the rectangle to test.
heightInt32The height of the rectangle to test.

Returns: Boolean. when any portion of the specified rectangle is contained within this Region; otherwise, .

Instance member IsVisible(rect)

Tests whether any portion of the specified Rectangle structure is contained within this Region.

ParameterTypeDescription
rectRectangleThe Rectangle structure to test.

Returns: Boolean. This method returns when any portion of rect is contained within this Region; otherwise, .

Instance member 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.

ParameterTypeDescription
xInt32The x-coordinate of the upper-left corner of the rectangle to test.
yInt32The y-coordinate of the upper-left corner of the rectangle to test.
widthInt32The width of the rectangle to test.
heightInt32The height of the rectangle to test.
gGraphicsA Graphics that represents a graphics context.

Returns: Boolean. when any portion of the specified rectangle is contained within this Region; otherwise, .

Instance member IsVisible(rect, g)

Tests whether any portion of the specified Rectangle structure is contained within this Region when drawn using the specified Graphics.

ParameterTypeDescription
rectRectangleThe Rectangle structure to test.
gGraphicsA Graphics that represents a graphics context.

Returns: Boolean. when any portion of the rect is contained within this Region; otherwise, .

Instance member MakeEmpty()

Initializes this Region to an empty interior.

Instance member MakeInfinite()

Initializes this Region object to an infinite interior.

Instance member Transform(matrix)

Transforms this Region by the specified Matrix.

ParameterTypeDescription
matrixMatrixThe Matrix by which to transform this Region.

Throws:

Instance member Translate(dx, dy)

Offsets the coordinates of this Region by the specified amount.

ParameterTypeDescription
dxInt32The amount to offset this Region horizontally.
dyInt32The amount to offset this Region vertically.

Instance member Translate(dx, dy)

Offsets the coordinates of this Region by the specified amount.

ParameterTypeDescription
dxSingleThe amount to offset this Region horizontally.
dySingleThe amount to offset this Region vertically.

Instance member Union(path)

Updates this Region to the union of itself and the specified GraphicsPath.

ParameterTypeDescription
pathGraphicsPathThe GraphicsPath to unite with this Region.

Throws:

Instance member Union(rect)

Updates this Region to the union of itself and the specified Rectangle structure.

ParameterTypeDescription
rectRectangleThe Rectangle structure to unite with this Region.

Instance member Union(rect)

Updates this Region to the union of itself and the specified RectangleF structure.

ParameterTypeDescription
rectRectangleFThe RectangleF structure to unite with this Region.

Instance member Union(region)

Updates this Region to the union of itself and the specified Region.

ParameterTypeDescription
regionRegionThe Region to unite with this Region.

Throws:

Instance member Xor(path)

Updates this Region to the union minus the intersection of itself with the specified GraphicsPath.

ParameterTypeDescription
pathGraphicsPathThe GraphicsPath to xor with this Region.

Throws:

Instance member Xor(rect)

Updates this Region to the union minus the intersection of itself with the specified Rectangle structure.

ParameterTypeDescription
rectRectangleThe Rectangle structure to xor with this Region.

Instance member Xor(rect)

Updates this Region to the union minus the intersection of itself with the specified RectangleF structure.

ParameterTypeDescription
rectRectangleFThe RectangleF structure to Xor with this Region.

Instance member Xor(region)

Updates this Region to the union minus the intersection of itself with the specified Region.

ParameterTypeDescription
regionRegionThe Region to xor with this Region.

Throws: