skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop

    Web

    Kendo UI UI for Angular UI for Vue UI for jQuery KendoReact UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Telerik JustMock

    CMS

    Sitefinity

    AI Productivity Tools

    AI Coding Assistants

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    KendoReact Free VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Forums
    • Videos
    • Blogs
    • Accessibility
    • Submit a Ticket

    Productivity and Design Tools

    • Visual Studio Extensions
    • Visual Studio Templates
    • Embedded Reporting
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class RectangleF

Describes a rectangle using float units.

Inheritance
System.Object
RectangleF
Namespace: Telerik.Windows.Documents.Model
Assembly: Telerik.Windows.Controls.RichTextBox.dll

Syntax

public sealed class RectangleF : ValueType

Constructors

RectangleF(Single, Single, Single, Single)

Initializes a new instance of the RectangleF struct.

Declaration
public RectangleF(float x, float y, float width, float height)
Parameters
System.Single x

The x position.

System.Single y

The y position.

System.Single width

The width.

System.Single height

The height.

RectangleF(PointF, SizeF)

Initializes a new instance of the RectangleF struct.

Declaration
public RectangleF(PointF location, SizeF size)
Parameters
PointF location

The location.

SizeF size

The size.

Fields

Empty

Empty rectangle.

Declaration
public static readonly RectangleF Empty
Field Value
RectangleF

Properties

Bottom

Gets the bottom.

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

The bottom.

Center

Gets the center point of the rectangle represented by this instance.

Declaration
public PointF Center { get; }
Property Value
PointF

A PointF representing the center point of the rectangle.

Height

Gets or sets the height.

Declaration
public float Height { get; set; }
Property Value
System.Single

The height.

IsEmpty

Gets a value indicating whether this instance is empty.

Declaration
public bool IsEmpty { get; }
Property Value
System.Boolean

true if this instance is empty; otherwise, false.

Left

Gets the left.

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

The left.

Location

Gets or sets the location.

Declaration
public PointF Location { get; set; }
Property Value
PointF

The location.

Right

Gets the right.

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

The right.

Size

Gets or sets the size.

Declaration
public SizeF Size { get; set; }
Property Value
SizeF

The size.

Top

Gets the top.

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

The top.

Width

Gets or sets the width.

Declaration
public float Width { get; set; }
Property Value
System.Single

The width.

X

Gets or sets the x position.

Declaration
public float X { get; set; }
Property Value
System.Single

The x position.

Y

Gets or sets the y position.

Declaration
public float Y { get; set; }
Property Value
System.Single

The y position.

Methods

Contains(Single, Single)

Determines whether this instance contains a point.

Declaration
public bool Contains(float x, float y)
Parameters
System.Single x

The x-coordinate of the point.

System.Single y

The y-coordinate of the point.

Returns
System.Boolean

true if contains the specified coordinates; otherwise, false.

Contains(PointF)

Determines whether this instance contains a point.

Declaration
public bool Contains(PointF point)
Parameters
PointF point

The point.

Returns
System.Boolean

true if contains the specified point; otherwise, false.

Contains(RectangleF)

Determines whether this instance contains the object.

Declaration
public bool Contains(RectangleF rect)
Parameters
RectangleF rect

The rect.

Returns
System.Boolean

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

Equals(Object)

Determines whether the specified System.Object, is equal to this instance.

Declaration
public override bool Equals(object obj)
Parameters
System.Object obj

The System.Object to compare with this instance.

Returns
System.Boolean

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

FromLtrb(Double, Double, Double, Double)

Froms the LTRB.

Declaration
public static RectangleF FromLtrb(double left, double top, double right, double bottom)
Parameters
System.Double left

The left.

System.Double top

The top.

System.Double right

The right.

System.Double bottom

The bottom.

Returns
RectangleF

GetHashCode()

Returns a hash code for this instance.

Declaration
public override int GetHashCode()
Returns
System.Int32

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

GetRoundedCopy(Int32)

Creates a new rectangle that is a rounded copy of the current rectangle.

Declaration
public RectangleF GetRoundedCopy(int decimals)
Parameters
System.Int32 decimals

The radius to be used for rounding the corners of the rectangle.

Returns
RectangleF

A new instance of RectangleF that has rounded corners based on the specified radius.

Inflate(Single, Single)

Inflates the specified x and y coordinates.

Declaration
public void Inflate(float x, float y)
Parameters
System.Single x

The x.

System.Single y

The y.

Inflate(RectangleF, Single, Single)

Inflates the specified rect.

Declaration
public static RectangleF Inflate(RectangleF rect, float x, float y)
Parameters
RectangleF rect

The rect.

System.Single x

The x.

System.Single y

The y.

Returns
RectangleF

Inflate(SizeF)

Inflates the specified size.

Declaration
public void Inflate(SizeF size)
Parameters
SizeF size

The size.

Intersect(RectangleF)

Intersects the specified rect.

Declaration
public void Intersect(RectangleF rect)
Parameters
RectangleF rect

The rect.

Intersect(RectangleF, RectangleF)

Determines the intersection of two rectangles and returns the overlapping area as a new rectangle.

Declaration
public static RectangleF Intersect(RectangleF rectangle1, RectangleF rectangle2)
Parameters
RectangleF rectangle1

The first rectangle to intersect.

RectangleF rectangle2

The second rectangle to intersect.

Returns
RectangleF

A new RectangleF that represents the intersecting area. If the rectangles do not intersect, an empty rectangle is returned.

IntersectsWith(RectangleF)

Determines whether this instance intersects with another rectangle.

Declaration
public bool IntersectsWith(RectangleF rect)
Parameters
RectangleF rect

The rect.

Returns
System.Boolean

Offset(Single, Single)

Offsets the rectangle by the specified amounts in the X and Y directions.

Declaration
public void Offset(float x, float y)
Parameters
System.Single x

The amount to offset the rectangle in the X direction.

System.Single y

The amount to offset the rectangle in the Y direction.

Offset(PointF)

Translates the rectangle by the specified point.

Declaration
public void Offset(PointF point)
Parameters
PointF point

A PointF that specifies the translation offset.

ToString()

Converts the rectangle's dimensions to a string representation.

Declaration
public override string ToString()
Returns
System.String

A string that represents the rectangle's dimensions in the format "Width: {width}, Height: {height}".

Union(RectangleF, RectangleF)

Calculates the union of two rectangles represented by RectangleF instances.

Declaration
public static RectangleF Union(RectangleF rectangle1, RectangleF rectangle2)
Parameters
RectangleF rectangle1

The first rectangle to be included in the union.

RectangleF rectangle2

The second rectangle to be included in the union.

Returns
RectangleF

A new RectangleF that represents the smallest rectangle that contains both input rectangles.

Operators

Equality(RectangleF, RectangleF)

Implements the operator ==.

Declaration
public static bool operator ==(RectangleF left, RectangleF right)
Parameters
RectangleF left

The left.

RectangleF right

The right.

Returns
System.Boolean

The result of the operator.

Implicit(Rect to RectangleF)

Declaration
public static implicit operator RectangleF(Rect rect)
Parameters
System.Windows.Rect rect

Returns
RectangleF

Inequality(RectangleF, RectangleF)

Implements the operator !=.

Declaration
public static bool operator !=(RectangleF left, RectangleF right)
Parameters
RectangleF left

The left.

RectangleF right

The right.

Returns
System.Boolean

The result of the operator.

Extension Methods

ExtensionMethods.AreClose(RectangleF, RectangleF)
ExtensionMethods.ToRect(RectangleF)
CollectionExtensions.ToEnumerable<T>(T)
EnumerableExtensions.ToEnumerable<T>(T)
Getting Started
  • Install Now
  • Demos
  • SDK Samples Browser
  • Sample Applications
Support Resources
  • Code Library
  • Knowledge Base
  • MVVM Support
  • Videos
  • GitHub SDK Repository
Community
  • Forums
  • Blogs
  • XAML Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.