New to Telerik UI for WinFormsStart a free 30-day trial

RadRect

Struct

Represents a Rectangle in the Euclidean plane geometry.

Definition

Namespace:Telerik.Charting

Assembly:Telerik.WinControls.dll

Syntax:

C#
public struct RadRect

Inherited Members ValueType.ToString()

Constructors

Initializes a new instance of the RadRect struct.

C#
public RadRect(double x, double y, double width, double height)
Parameters:xdouble

The X-coordinate of the rectangle.

ydouble

The Y-coordinate of the rectangle.

widthdouble

The width of the rectangle.

heightdouble

The height of the rectangle.

Initializes a new instance of the RadRect struct.

C#
public RadRect(double width, double height)
Parameters:widthdouble

The width of the rectangle.

heightdouble

The height of the rectangle.

Initializes a new instance of the RadRect struct.

C#
public RadRect(RadPoint point1, RadPoint point2)
Parameters:point1RadPoint

The first point defining the rectangle bounds.

point2RadPoint

The second point defining the rectangle bounds.

Fields

Empty rectangle which values are zeroes.

C#
public static readonly RadRect Empty

The length of the rectangle along the Y-axis.

C#
public double Height

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

C#
public static readonly RadRect Invalid

The length of the rectangle along the X-axis.

C#
public double Width

The X-coordinate of the rectangle.

C#
public double X

The Y-coordinate of the rectangle.

C#
public double Y

Properties

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

C#
public double Bottom { get; }

Gets the center of this rectangle.

C#
public RadPoint Center { get; }

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

C#
public RadPoint Location { get; }

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

C#
public double Right { get; }

Methods

Centers the specified rectangle within the provided available one.

C#
public static RadRect CenterRect(RadRect rect, RadRect bounds)
Parameters:rectRadRectboundsRadRectReturns:

RadRect

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

C#
public bool Contains(double x, double y)
Parameters:xdouble

The X coordinate of the point to check.

ydouble

The Y coordinate of the point to check.

Returns:

bool

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

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)

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

C#
public static RadRect Floor(RadRect rect)
Parameters:rectRadRectReturns:

RadRect

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()

Determines whether the current rect intersects with the specified one.

C#
public bool IntersectsWith(RadRect rect)
Parameters:rectRadRectReturns:

bool

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

C#
public bool IsSizeValid()
Returns:

bool

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

C#
public static RadRect Round(RadRect rect)
Parameters:rectRadRect

The RadRect that will be rounded.

Returns:

RadRect

A new instance of RadRect with rounded values.

Rounds the rectangle's values by respecting the X and Right and respecting the Y and Bottom. (0.4, 0, 2.2, 0) results in (0, 0, 3, 0). Note: original width = 3, result width = 2.2; original right = 2.6, result right = 3. (0.4, 0, 2.0, 0) results in (0, 0, 2, 0). (0.6, 0, 1.8, 0) results in (1, 0, 1, 0). Note: original width = 1.8, result width = 1; original right = 2.4, result right = 2. (0.6, 0, 2.0, 0) results in (1, 0, 2, 0).

C#
public static RadRect RoundByRespectingLocation(double rectX, double rectY, double rectWidth, double rectHeight)
Parameters:rectXdoublerectYdoublerectWidthdoublerectHeightdoubleReturns:

RadRect

Gets the difference between two RadRect structures.

C#
public static RadThickness Subtract(RadRect rect1, RadRect rect2)
Parameters:rect1RadRectrect2RadRectReturns:

RadThickness

Gets a rectangle that has equal width and height and is centered within the specified rect.

C#
public static RadRect ToSquare(RadRect rect, bool offset)
Parameters:rectRadRectoffsetboolReturns:

RadRect

Operators

Determines whether two RadRect structures are not equal.

C#
public static bool operator !=(RadRect rect1, RadRect rect2)
Parameters:rect1RadRectrect2RadRectReturns:

bool

Determines whether two RadRect structures are equal.

C#
public static bool operator ==(RadRect rect1, RadRect rect2)
Parameters:rect1RadRectrect2RadRectReturns:

bool