Click or drag to resize

Rectangle Structure

Represents a rectangle with a location (X, Y) and size (Width, Height) components.

Namespace:  Eto.Drawing
Assembly:  Eto (in Eto.dll) Version: 2.5.3-dev
Syntax
public struct Rectangle : IEquatable<Rectangle>

The Rectangle type exposes the following members.

Constructors
  NameDescription
Public methodRectangle(RectangleF)
Initializes a new instance of a Rectangle class with truncated values of the specified floating-point rectangle
Public methodRectangle(Size)
Initializes a new instance of the Rectangle class with X, Y co-ordinates at 0,0 and the specified size
Public methodRectangle(Point, Point)
Initializes a new instance of the Rectangle class with two points
Public methodRectangle(Point, Size)
Initializes a new instance of the Rectangle class with the specified location and size
Public methodRectangle(Int32, Int32, Int32, Int32)
Initializes a new instance of the Rectangle class with the specified x, y, width, and height
Top
Properties
  NameDescription
Public propertyBottom
Gets or sets the logical bottom of this rectangle (Y + Height if Height is positive, Y + 1 if negative)
Public propertyBottomLeft
Gets or sets the point at the Bottom and Left of the rectangle
Public propertyBottomRight
Gets or sets the point at the Bottom and Right of the rectangle
Public propertyCenter
Gets or sets the rectangle's center position
Public propertyEndLocation
Gets the ending location of this rectangle
Public propertyHeight
Gets or sets the Height of this rectangle
Public propertyInnerBottom
Gets or sets the bottom of the rectangle that is inside the bounds
Public propertyInnerBottomLeft
Gets or sets the point at the InnerBottom and Left of the rectangle
Public propertyInnerBottomRight
Gets or sets the point at the InnerBottom and InnerRight of the rectangle
Public propertyInnerRight
Gets or sets the right of the rectangle that is inside the bounds
Public propertyInnerTopRight
Gets or sets the point at the Top and InnerRight of the rectangle
Public propertyIsEmpty
Gets a value indicating that the Size of this rectangle is empty (either the width or height are zero)
Public propertyIsZero
Gets a value indicating that both the and Size of this rectangle are zero
Public propertyLeft
Gets or sets the logical left of this rectangle (X co-ordinate if Width is positive, X + Width if negative)
Public propertyLocation
Gets the location of this rectangle
Public propertyMiddleBottom
Gets or sets the point at the MiddleX and Bottom of the rectangle
Public propertyMiddleLeft
Gets or sets the point at the Left and MiddleY of the rectangle
Public propertyMiddleRight
Gets or sets the point at the Right and MiddleY of the rectangle
Public propertyMiddleTop
Gets or sets the point at the MiddleX and Top of the rectangle
Public propertyMiddleX
Gets or sets the rectangle's middle horizontal position
Public propertyMiddleY
Gets or sets the rectangle's middle vertical position
Public propertyRight
Gets or sets the logical right of this rectangle (X + Width if Width is positive, X + 1 if negative)
Public propertySize
Gets or sets the size of the rectangle
Public propertyTop
Gets or sets the logical top of this rectangle (Y co-ordinate if Height is positive, Y + Height if negative)
Public propertyTopLeft
Gets or sets the point at the Top and Left of the rectangle
Public propertyTopRight
Gets or sets the point at the Top and Right of the rectangle
Public propertyWidth
Gets or sets the Width of this rectangle
Public propertyX
Gets or sets the X co-ordinate of the Location of this rectangle
Public propertyY
Gets or sets the Y co-ordinate of the Location of this rectangle
Top
Methods
  NameDescription
Public methodAlign(Size)
Aligns the rectangle to a grid of the specified gridSize
Public methodAlign(Int32, Int32)
Aligns the rectangle to a grid of the specified gridWidth and gridHeight
Public methodStatic memberAlign(Rectangle, Size)
Aligns the rectangle to a grid of the specified gridSize
Public methodStatic memberAlign(Rectangle, Int32, Int32)
Aligns the rectangle to a grid of the specified gridWidth and gridHeight
Public methodStatic memberCeiling
Converts a floating point rectangle to an integral Rectangle by getting the smallest integral value of X, Y, Width, and Height
Public methodContains(Point)
Gets a value indicating that the specified point is within the bounds of this rectangle
Public methodContains(Rectangle)
Gets a value indicating that the specified rectangle is entirely contained within the bounds of this rectangle
Public methodContains(Int32, Int32)
Gets a value indicating that the specified x and y co-ordinates are within the bounds of this rectangle
Public methodEquals(Object)
Compares this rectangle to an object for equality
(Overrides ValueTypeEquals(Object).)
Public methodEquals(Rectangle)
Compares this rectangle with the specified other rectangle
Public methodStatic memberFromCenter
Creates a new instance of a Rectangle with a specified center and size
Public methodStatic memberFromSides
Creates a new instance of a RectangleF from the values of the left, top, right and bottom sides
Public methodGetHashCode
Gets the hash code for this rectangle
(Overrides ValueTypeGetHashCode.)
Public methodInflate(Size)
Inflates all dimensions of this rectangle by the specified size
Public methodInflate(Int32, Int32)
Inflates all dimensions of this rectangle by the specified width and height
Public methodStatic memberInflate(Rectangle, Size)
Inflates all dimensions of the rectangle by the specified size
Public methodStatic memberInflate(Rectangle, Int32, Int32)
Inflates all dimensions of this rectangle by the specified width and height
Public methodIntersect(Rectangle)
Intersect the rectangle with the specified rectangle
Public methodStatic memberIntersect(Rectangle, Rectangle)
Intersect the two specified rectangles
Public methodIntersects
Gets a value indicating that the specified rectangle overlaps this rectangle
Public methodNormalize
Normalizes the rectangle so both the Width and Height are positive, without changing the location of the rectangle
Public methodOffset(Point)
Offsets the location of the rectangle by the X and Y values of the specified point
Public methodOffset(Size)
Offsets the location of the rectangle by the specified size
Public methodOffset(Int32, Int32)
Offsets the location of the rectangle by the specified x and y values
Public methodStatic memberOffset(Rectangle, Point)
Offsets the location of the rectangle by the X and Y values of the specified point
Public methodStatic memberOffset(Rectangle, Size)
Offsets the location of the rectangle by the specified size
Public methodStatic memberOffset(Rectangle, Int32, Int32)
Offsets the location of the rectangle by the specified x and y values
Public methodRestrict(Rectangle)
Restricts the rectangle to be within the specified rectangle
Public methodRestrict(Size)
Restricts the rectangle to be within the specified size at an X,Y location of 0, 0
Public methodRestrict(Point, Size)
Restricts the rectangle to be within the specified location and size
Public methodStatic memberRestrict(Rectangle, Rectangle)
Restricts the rectangle to be within the restrict rectangle
Public methodStatic memberRestrict(Rectangle, Size)
Restricts the rectangle to be within the specified size
Public methodStatic memberRound
Converts a floating point rectangle to an integral Rectangle by rounding the X, Y, Width, and Height.
Public methodToString
Converts this rectangle to a string
(Overrides ValueTypeToString.)
Public methodStatic memberTruncate
Converts a floating point rectangle to an integral Rectangle by truncating the X, Y, Width, and Height values
Public methodUnion(Rectangle)
Union the rectangle into this instance to encompass both rectangles
Public methodStatic memberUnion(Rectangle, Rectangle)
Combines two rectangles into one rectangle that encompasses both
Top
Operators
  NameDescription
Public operatorStatic memberAddition(Rectangle, Point)
Adds the offset to the specified rectangle, moving its location
Public operatorStatic memberAddition(Rectangle, Size)
Adds the offset to the specified rectangle, moving its location
Public operatorStatic memberDivision(Rectangle, Size)
Divides the specified rectangle by the Width and Height of size
Public operatorStatic memberDivision(Rectangle, Int32)
Divides all X, Y, Width, Height components of the rectangle by a factor factor
Public operatorStatic memberEquality
Compares two rectangles for equality
Public operatorStatic member(RectangleF to Rectangle)
Implicit conversion from a RectangleF to a Rectangle
Public operatorStatic memberInequality
Compares two rectangles for inequality
Public operatorStatic memberMultiply(Rectangle, Size)
Multiplies the specified rectangle by the Width and Height of size
Public operatorStatic memberMultiply(Rectangle, Int32)
Multiplies all X, Y, Width, Height components of the rectangle by a factor
Public operatorStatic memberSubtraction(Rectangle, Point)
Subtracts the offset from the specified rectangle, moving its location
Public operatorStatic memberSubtraction(Rectangle, Size)
Subtracts the offset from the specified rectangle, moving its location
Top
Fields
  NameDescription
Public fieldStatic memberEmpty
Gets an empty rectangle with zero X, Y, Width, and Height components
Top
Remarks
A rectangle is defined by a location (X, Y) and a size (Width, Height). The width and/or height can be negative.
See Also