Show / Hide Table of Contents

Class RectangleF

Represent a rectangle.

Inheritance
System.Object
RectangleF
Implements
System.IEquatable<RectangleF>
Namespace: BonEngineSharp.Framework
Assembly: BonEngineSharp.dll
Syntax
public sealed class RectangleF : ValueType, IEquatable<RectangleF>

Constructors

RectangleF(Single, Single, Single, Single)

Create the rectangle.

Declaration
public RectangleF(float x = 0F, float y = 0F, float width = 0F, float height = 0F)
Parameters
Type Name Description
System.Single x
System.Single y
System.Single width
System.Single height

Fields

Empty

An empty rectangle const.

Declaration
public static readonly RectangleF Empty
Field Value
Type Description
RectangleF

Height

Rectangle height.

Declaration
public float Height
Field Value
Type Description
System.Single

Width

Rectangle width.

Declaration
public float Width
Field Value
Type Description
System.Single

X

X position.

Declaration
public float X
Field Value
Type Description
System.Single

Y

Y position.

Declaration
public float Y
Field Value
Type Description
System.Single

Properties

Bottom

Set / get rectangle bottom position.

Declaration
public float Bottom { get; set; }
Property Value
Type Description
System.Single

Center

Get absolute center point. Check if contains a point.

Declaration
public PointF Center { get; }
Property Value
Type Description
PointF

Left

Set / get rectangle left position.

Declaration
public float Left { get; set; }
Property Value
Type Description
System.Single

Right

Set / get rectangle right position.

Declaration
public float Right { get; set; }
Property Value
Type Description
System.Single

Top

Set / get rectangle top position.

Declaration
public float Top { get; set; }
Property Value
Type Description
System.Single

Methods

Clone()

Clone this rectangle.

Declaration
public RectangleF Clone()
Returns
Type Description
RectangleF

Cloned rectangle.

Contains(PointF)

Check if contains a point.

Declaration
public bool Contains(PointF point)
Parameters
Type Name Description
PointF point

Point to check.

Returns
Type Description
System.Boolean

If point is within the rectangle.

Contains(RectangleF)

Check if containing another rectangle.

Declaration
public bool Contains(RectangleF other)
Parameters
Type Name Description
RectangleF other

Other rectangle to test.

Returns
Type Description
System.Boolean

True if other rectangle is inside this rectangle.

Equals(RectangleF)

Check if this Rectangle equals to another Rectangle.

Declaration
public bool Equals(RectangleF other)
Parameters
Type Name Description
RectangleF other
Returns
Type Description
System.Boolean

Equals(Object)

Check if this Rectangle equals to another object.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean

FromString(String)

Create rectangle from string.

Declaration
public static RectangleF FromString(string str)
Parameters
Type Name Description
System.String str

String to convert to rectangle (x,y,wight,height)

Returns
Type Description
RectangleF

Rectangle instance.

GetHashCode()

Implement hash code of color.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

Overlaps(RectangleF)

Check if intersects with or containing another rectangle.

Declaration
public bool Overlaps(RectangleF other)
Parameters
Type Name Description
RectangleF other

Other rectangle to check.

Returns
Type Description
System.Boolean

True if containing or intersecting with given rectangle.

Reset()

Reset the rectangle.

Declaration
public void Reset()

Set(Single, Single, Single, Single)

Set the rectangle components.

Declaration
public void Set(float x, float y, float w, float h)
Parameters
Type Name Description
System.Single x
System.Single y
System.Single w
System.Single h

Operators

Equality(RectangleF, RectangleF)

Implement == operator.

Declaration
public static bool operator ==(RectangleF obj1, RectangleF obj2)
Parameters
Type Name Description
RectangleF obj1
RectangleF obj2
Returns
Type Description
System.Boolean

Implicit(RectangleF to RectangleI)

Implicit conversion to RectangleI.

Declaration
public static implicit operator RectangleI(RectangleF p)
Parameters
Type Name Description
RectangleF p
Returns
Type Description
RectangleI

Inequality(RectangleF, RectangleF)

Implement != operator.

Declaration
public static bool operator !=(RectangleF obj1, RectangleF obj2)
Parameters
Type Name Description
RectangleF obj1
RectangleF obj2
Returns
Type Description
System.Boolean

Implements

System.IEquatable<>
Back to top Generated by DocFX