Show / Hide Table of Contents

Struct Rectangle

Represents a rectangle of a given Position and Size.

Implements
IEquatable<Rectangle>
Namespace: MarcusW.VncClient
Assembly: MarcusW.VncClient.dll
Syntax
public struct Rectangle : IEquatable<Rectangle>

Constructors

| Improve this Doc View Source

Rectangle(Position, Size)

Initializes a new instance of the Rectangle structure.

Declaration
public Rectangle(Position position, Size size)
Parameters
Type Name Description
Position position

The position of the upper left corner of the rectangle.

Size size

The size of the rectangle.

| Improve this Doc View Source

Rectangle(Int32, Int32, Int32, Int32)

Initializes a new instance of the Rectangle structure.

Declaration
public Rectangle(int x, int y, int width, int height)
Parameters
Type Name Description
System.Int32 x

The x coordinate of the upper left corner of the rectangle.

System.Int32 y

The y coordinate of the upper left corner of the rectangle.

System.Int32 width

The width of the rectangle.

System.Int32 height

The height of the rectangle.

Fields

| Improve this Doc View Source

Zero

A rectangle with the size zero at the origin of the coordinate system.

Declaration
public static readonly Rectangle Zero
Field Value
Type Description
Rectangle

Properties

| Improve this Doc View Source

Position

Gets the position of the upper left corner of the rectangle.

Declaration
public Position Position { get; }
Property Value
Type Description
Position
| Improve this Doc View Source

Size

Gets the size of the rectangle.

Declaration
public Size Size { get; }
Property Value
Type Description
Size

Methods

| Improve this Doc View Source

CroppedTo(Rectangle)

Returns a new Rectangle that is reduced enough to make it fit inside the given area.

Declaration
public Rectangle CroppedTo(in Rectangle area)
Parameters
Type Name Description
Rectangle area

The area in which the rectangle should fit in.

Returns
Type Description
Rectangle

A new rectangle.

| Improve this Doc View Source

Equals(Rectangle)

Declaration
public bool Equals(Rectangle other)
Parameters
Type Name Description
Rectangle other
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Equals(Nullable<Object>)

Declaration
public override bool Equals(object? obj)
Parameters
Type Name Description
System.Nullable<System.Object> obj
Returns
Type Description
System.Boolean
| Improve this Doc View Source

FitsInside(Rectangle)

Returns whether this rectangle completely fits inside the given area.

Declaration
public bool FitsInside(in Rectangle area)
Parameters
Type Name Description
Rectangle area

The area in which the rectangle should fit in.

Returns
Type Description
System.Boolean

True if it fits inside, otherwise false.

| Improve this Doc View Source

FitsInside(Size)

Returns whether this rectangle completely fits inside an area in the origin with the given size.

Declaration
public bool FitsInside(in Size areaSize)
Parameters
Type Name Description
Size areaSize

The size of the area in which the rectangle should fit in.

Returns
Type Description
System.Boolean

True if it fits inside, otherwise false.

| Improve this Doc View Source

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
| Improve this Doc View Source

IsEmpty()

Returns whether this rectangle has no content (one side is zero)

Declaration
public bool IsEmpty()
Returns
Type Description
System.Boolean

True if it has no content, otherwise false.

| Improve this Doc View Source

Overlaps(Rectangle)

Returns whether this rectangle overlaps the given area.

Declaration
public bool Overlaps(in Rectangle area)
Parameters
Type Name Description
Rectangle area

The area to test for.

Returns
Type Description
System.Boolean

True if they overlap, otherwise false.

| Improve this Doc View Source

ToString()

Returns the string representation of the rectangle.

Declaration
public override string ToString()
Returns
Type Description
System.String

The string representation of the rectangle.

| Improve this Doc View Source

WithPosition(Position)

Returns a new Rectangle with the specified position.

Declaration
public Rectangle WithPosition(Position position)
Parameters
Type Name Description
Position position

The position.

Returns
Type Description
Rectangle

A new rectangle.

| Improve this Doc View Source

WithSize(Size)

Returns a new Rectangle with the specified size.

Declaration
public Rectangle WithSize(Size size)
Parameters
Type Name Description
Size size

The size.

Returns
Type Description
Rectangle

A new rectangle.

Operators

| Improve this Doc View Source

Equality(Rectangle, Rectangle)

Checks for equality between two Rectangles.

Declaration
public static bool operator ==(Rectangle left, Rectangle right)
Parameters
Type Name Description
Rectangle left

The first rectangle.

Rectangle right

The second rectangle.

Returns
Type Description
System.Boolean

True if the rectangles are equal, otherwise false.

| Improve this Doc View Source

Inequality(Rectangle, Rectangle)

Checks for inequality between two Rectangles.

Declaration
public static bool operator !=(Rectangle left, Rectangle right)
Parameters
Type Name Description
Rectangle left

The first rectangle.

Rectangle right

The second rectangle.

Returns
Type Description
System.Boolean

True if the rectangles are unequal, otherwise false.

Implements

IEquatable<>
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX