skip navigation
  • Product Bundles

    DevCraft

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

    • AI Coding Assistants
    • Embedded Reporting
    • Document Processing Libraries
    • SSO Account Sign-in

    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 RadRect

Represents a Rectangle in the Euclidean plane geometry.

Inheritance
System.Object
RadRect
Namespace: Telerik.Charting
Assembly: Telerik.Windows.Controls.Chart.dll

Syntax

public sealed class RadRect : ValueType

Constructors

RadRect(Double, Double)

Initializes a new instance of the RadRect struct.

Declaration
public RadRect(double width, double height)
Parameters
System.Double width

The width.

System.Double height

The height.

RadRect(Double, Double, Double, Double)

Initializes a new instance of the RadRect struct.

Declaration
public RadRect(double x, double y, double width, double height)
Parameters
System.Double x

The X coordinate of the Top-Left corner.

System.Double y

The Y coordinate of the Top-Left corner.

System.Double width

The width.

System.Double height

The height.

RadRect(RadPoint, RadPoint)

Initializes a new instance of the RadRect struct.

Declaration
public RadRect(RadPoint point1, RadPoint point2)
Parameters
RadPoint point1

The point1.

RadPoint point2

The point2.

RadRect(RadPoint, RadSize)

Initializes a new instance of the RadRect struct.

Declaration
public RadRect(RadPoint location, RadSize size)
Parameters
RadPoint location

The location of the Top-Left corner.

RadSize size

The size of the RadRect struct.

Fields

Empty

Empty rectangle which values are zeroes.

Declaration
public static readonly RadRect Empty
Field Value
RadRect

Height

The length of the rectangle along the Y-axis.

Declaration
public double Height
Field Value
System.Double

Invalid

Invalid rectangle, which Width and Height properties are set to (-1).

Declaration
public static readonly RadRect Invalid
Field Value
RadRect

Width

The length of the rectangle along the X-axis.

Declaration
public double Width
Field Value
System.Double

X

The X-coordinate of the rectangle.

Declaration
public double X
Field Value
System.Double

Y

The Y-coordinate of the rectangle.

Declaration
public double Y
Field Value
System.Double

Properties

Bottom

Gets the Y-coordinate of the bottom side of the rectangle.

Declaration
public double Bottom { get; }
Property Value
System.Double

Center

Gets the center of this rectangle.

Declaration
public RadPoint Center { get; }
Property Value
RadPoint

IsEmpty

Gets indicating if the RadRect is empty.

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

Location

Gets the location (Top-Left corner) of the rectangle.

Declaration
public RadPoint Location { get; }
Property Value
RadPoint

Right

Gets the X-coordinate of the right side of the rectangle.

Declaration
public double Right { get; }
Property Value
System.Double

Size

Gets the size the RadRect.

Declaration
public RadSize Size { get; }
Property Value
RadSize

The size.

Methods

CenterRect(RadRect, RadRect)

Centers the specified rectangle within the provided available one.

Declaration
public static RadRect CenterRect(RadRect rect, RadRect bounds)
Parameters
RadRect rect

The RadRect that should be moved to the new location.

RadRect bounds

The RadRect that specifies the available bounds.

Returns
RadRect

A new instance of RadRect with width and height as the given RadRect and placed in the center of the provided region.

Contains(Double, Double)

Determines if this RadRect instance contains the point that is described by the arguments.

Declaration
public bool Contains(double x, double y)
Parameters
System.Double x

The X coordinate of the point to check.

System.Double y

The Y coordinate of the point to check.

Returns
System.Boolean

Returns true if this rectangle contains the point from the arguments and false otherwise.

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.

Floor(RadRect)

Rounds the rectangle's value to the closest less than or equal to whole numbers.

Declaration
public static RadRect Floor(RadRect rect)
Parameters
RadRect rect

The RadRect that will be rounded.

Returns
RadRect

A new instance of RadRect with rounded values.

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.

Inflate(RadRect, RadThickness)

Returns the rectangle that results from expanding or shrinking the specified rectangle with the specified margins.

Declaration
public static RadRect Inflate(RadRect rect, RadThickness margins)
Parameters
RadRect rect

The RadRect structure to modify.

RadThickness margins

The margins.

Returns
RadRect

A new instance of RadRect with modified dimensions.

Intersect(RadRect)

Finds the intersection of the current rectangle and the specified rectangle, and stores the result as the current rectangle.

Declaration
public void Intersect(RadRect rect)
Parameters
RadRect rect

The rectangle to intersect with the current rectangle.

IntersectsWith(RadRect)

Determines whether the current RadRect intersects with the specified one.

Declaration
public bool IntersectsWith(RadRect rect)
Parameters
RadRect rect

Returns
System.Boolean

IsSizeValid()

Determines whether the size of this RadRect is valid - that is both Width and Height should be bigger than zero.

Declaration
public bool IsSizeValid()
Returns
System.Boolean

Round(RadRect)

Rounds the rectangle's values by respecting the Width and Height.

Declaration
public static RadRect Round(RadRect rect)
Parameters
RadRect rect

The RadRect that will be rounded.

Returns
RadRect

A new instance of RadRect with rounded values.

Subtract(RadRect, RadRect)

Gets the difference between two RadRect structures.

Declaration
public static RadThickness Subtract(RadRect rect1, RadRect rect2)
Parameters
RadRect rect1

The first RadRect.

RadRect rect2

The second RadRect.

Returns
RadThickness

A RadThickness instance, that represents the difference between the two RadRect instances.

ToSquare(RadRect, Boolean)

Gets a RadRect that has equal width and height and fits within the specified RadRect.

Declaration
public static RadRect ToSquare(RadRect rect, bool offset)
Parameters
RadRect rect

The RadRect.

System.Boolean offset

Specifies whether the resulting RadRect should keep the original Top-Left location or it should be centered within the original RadRect.

Returns
RadRect

A new instance of RadRect with equal width and height, that fits within the provided bounds.

Operators

Equality(RadRect, RadRect)

Determines whether two RadRect structures are equal.

Declaration
public static bool operator ==(RadRect rect1, RadRect rect2)
Parameters
RadRect rect1

The first RadRect.

RadRect rect2

The second RadRect.

Returns
System.Boolean

true if the values of the operands are equal, otherwise false.

Inequality(RadRect, RadRect)

Determines whether two RadRect structures are not equal.

Declaration
public static bool operator !=(RadRect rect1, RadRect rect2)
Parameters
RadRect rect1

The first RadRect.

RadRect rect2

The second RadRect.

Returns
System.Boolean

true if the values of the operands are not equal, otherwise false.

Extension Methods

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.