New to Telerik UI for WinForms? Start a free 30-day trial

Describes a rectanlge using float units.

Definition

Namespace:Telerik.WinForms.Documents.Model

Assembly:Telerik.WinControls.RichTextEditor.dll

Syntax:

C#
public struct RectangleF

Constructors

Initializes a new instance of the RectangleF struct.

C#
public RectangleF(float x, float y, float width, float height)
Parameters:xfloat

The x position.

yfloat

The y position.

widthfloat

The width.

heightfloat

The height.

Initializes a new instance of the RectangleF struct.

C#
public RectangleF(PointF location, SizeF size)
Parameters:locationPointF

The location.

sizeSizeF

The size.

Fields

Empty rectangle.

C#
public static readonly RectangleF Empty

Properties

Gets the bottom.

C#
[Browsable(false)]
public float Bottom { get; }
Property Value:

The bottom.

Gets the point halfway between the rectangle's horizontal and vertical edges.

C#
public PointF Center { get; }

Gets or sets the height.

C#
public float Height { readonly get; set; }
Property Value:

The height.

Gets a value indicating whether this instance is empty.

C#
[Browsable(false)]
public bool IsEmpty { get; }
Property Value:

true if this instance is empty; otherwise, false.

Gets the left.

C#
[Browsable(false)]
public float Left { get; }
Property Value:

The left.

Gets or sets the location.

C#
[Browsable(false)]
public PointF Location { get; set; }
Property Value:

The location.

Gets the right.

C#
[Browsable(false)]
public float Right { get; }
Property Value:

The right.

Gets or sets the size.

C#
[Browsable(false)]
public SizeF Size { get; set; }
Property Value:

The size.

Gets the top.

C#
[Browsable(false)]
public float Top { get; }
Property Value:

The top.

Gets or sets the width.

C#
public float Width { readonly get; set; }
Property Value:

The width.

Gets or sets the x position.

C#
public float X { readonly get; set; }
Property Value:

The x position.

Gets or sets the y position.

C#
public float Y { readonly get; set; }
Property Value:

The y position.

Methods

Determines whether this instance contains a point.

C#
public bool Contains(float x, float y)
Parameters:xfloat

The x-coordinate of the point.

yfloat

The y-coordinate of the point.

Returns:

bool

true if contains the specified coordinates; otherwise, false.

Determines whether this instance contains a point.

C#
public bool Contains(PointF point)
Parameters:pointPointF

The point.

Returns:

bool

true if contains the specified point; otherwise, false.

Determines whether this instance contains the object.

C#
public bool Contains(RectangleF rect)
Parameters:rectRectangleF

The rect.

Returns:

bool

true if this instance contains the specified rect; otherwise, false.

Determines whether the specified object, is equal to this instance.

C#
public override bool Equals(object obj)
Parameters:objobject

The object to compare with this instance.

Returns:

bool

true if the specified object is equal to this instance; otherwise, false.

Overrides: ValueType.Equals(object)

Froms the LTRB.

C#
public static RectangleF FromLtrb(double left, double top, double right, double bottom)
Parameters:leftdouble

The left.

topdouble

The top.

rightdouble

The right.

bottomdouble

The bottom.

Returns:

RectangleF

Returns a hash code for this instance.

C#
public override int GetHashCode()
Returns:

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

Overrides: ValueType.GetHashCode()

Creates a copy with each position and dimension rounded to the specified number of decimal places.

C#
public RectangleF GetRoundedCopy(int decimals)
Parameters:decimalsint

The number of decimal places to retain for each component.

Returns:

RectangleF

A rounded copy; this rectangle is not modified.

Inflates the specified x and y coordinates.

C#
public void Inflate(float x, float y)
Parameters:xfloat

The x.

yfloat

The y.

Inflates the specified rect.

C#
public static RectangleF Inflate(RectangleF rect, float x, float y)
Parameters:rectRectangleF

The rect.

xfloat

The x.

yfloat

The y.

Returns:

RectangleF

Inflates the specified size.

C#
public void Inflate(SizeF size)
Parameters:sizeSizeF

The size.

Returns the rectangular area shared by the two rectangles. If they do not overlap, returns Empty. Rectangles that touch only at an edge or corner produce an intersection with a zero width or height.

C#
public static RectangleF Intersect(RectangleF rectangle1, RectangleF rectangle2)
Parameters:rectangle1RectangleF

The first rectangle.

rectangle2RectangleF

The second rectangle.

Returns:

RectangleF

The intersection of the rectangles, or Empty when they do not overlap.

Intersects the specified rect.

C#
public void Intersect(RectangleF rect)
Parameters:rectRectangleF

The rect.

Determines whether this instance intersects with another rectangle.

C#
public bool IntersectsWith(RectangleF rect)
Parameters:rectRectangleF

The rect.

Returns:

bool

Moves the rectangle by the specified horizontal and vertical offsets without changing its dimensions.

C#
public void Offset(float x, float y)
Parameters:xfloat

The horizontal offset.

yfloat

The vertical offset.

Moves the rectangle by the specified point without changing its dimensions.

C#
public void Offset(PointF point)
Parameters:pointPointF

The horizontal and vertical offsets to apply.

Returns a brace-delimited representation containing the X, Y, Width, and Height values.

C#
public override string ToString()
Returns:

string

A string containing this rectangle's position and dimensions.

Overrides: ValueType.ToString()

Returns a rectangle spanning the minimum left and top edges and maximum right and bottom edges of both inputs.

C#
public static RectangleF Union(RectangleF rectangle1, RectangleF rectangle2)
Parameters:rectangle1RectangleF

The first rectangle.

rectangle2RectangleF

The second rectangle.

Returns:

RectangleF

A rectangle spanning both inputs.

Operators

Converts a WinForms UI rectangle to this float-based rectangle.

C#
public static implicit operator RectangleF(Rect rect)
Parameters:rectRect

The rectangle to convert.

Returns:

RectangleF

A rectangle with the source coordinates and dimensions converted to float.

Implements the operator !=.

C#
public static bool operator !=(RectangleF left, RectangleF right)
Parameters:leftRectangleF

The left.

rightRectangleF

The right.

Returns:

bool

The result of the operator.

Implements the operator ==.

C#
public static bool operator ==(RectangleF left, RectangleF right)
Parameters:leftRectangleF

The left.

rightRectangleF

The right.

Returns:

bool

The result of the operator.

Extension Methods