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

RadRect

Struct

Represents a Rectangle in the Euclidean plane geometry.

Definition

Namespace:Telerik.Charting

Assembly:Telerik.Windows.Controls.Chart.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 Top-Left corner.

ydouble

The Y coordinate of the Top-Left corner.

widthdouble

The width.

heightdouble

The height.

Initializes a new instance of the RadRect struct.

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

The width.

heightdouble

The height.

Initializes a new instance of the RadRect struct.

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

The point1.

point2RadPoint

The point2.

Initializes a new instance of the RadRect struct.

C#
public RadRect(RadPoint location, RadSize size)
Parameters:locationRadPoint

The location of the Top-Left corner.

sizeRadSize

The size of the RadRect struct.

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 indicating if the RadRect is empty.

C#
public bool IsEmpty { 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; }

Gets the size the RadRect.

C#
public RadSize Size { get; }
Property Value:

The size.

Methods

Centers the specified rectangle within the provided available one.

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

The RadRect that should be moved to the new location.

boundsRadRect

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.

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:rectRadRect

The RadRect that will be rounded.

Returns:

RadRect

A new instance of RadRect with rounded values.

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

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

C#
public static RadRect Inflate(RadRect rect, RadThickness margins)
Parameters:rectRadRect

The RadRect structure to modify.

marginsRadThickness

The margins.

Returns:

RadRect

A new instance of RadRect with modified dimensions.

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

C#
public void Intersect(RadRect rect)
Parameters:rectRadRect

The rectangle to intersect with the current rectangle.

Determines whether the current RadRect intersects with the specified one.

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

bool

Determines whether the size of this RadRect 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.

Gets the difference between two RadRect structures.

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

The first RadRect.

rect2RadRect

The second RadRect.

Returns:

RadThickness

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

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

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

The RadRect.

offsetbool

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

Determines whether two RadRect structures are not equal.

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

The first RadRect.

rect2RadRect

The second RadRect.

Returns:

bool

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

Determines whether two RadRect structures are equal.

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

The first RadRect.

rect2RadRect

The second RadRect.

Returns:

bool

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