Class Rectangle

Definition

Namespace:
Tizen.NUI
Assembly:
Tizen.NUI.dll

The Rectangle class. This class is used to define and manipulate rectangular areas in graphics or UI components. It manages the position (x, y coordinates) and size (width, height) of the rectangle, and provides various methods to set or inspect the properties of the rectangle.

C#
Copy
public class Rectangle : Disposable, IDisposable, ICloneable
Inheritance
object
Rectangle
Implements
System.IDisposable
System.ICloneable

Constructors

View Source

Rectangle()

The default constructor of Rectangle class.

Declaration
C#
Copy
public Rectangle()
View Source

Rectangle(int, int, int, int)

The constructor.

Declaration
C#
Copy
public Rectangle(int x, int y, int width, int height)
Parameters
Type Name Description
int x

The x coordinate (or left).

int y

The y coordinate (or right).

int width

The width (or bottom).

int height

The height (or top).

Properties

View Source

Height

The height of the rectangle.

Declaration
C#
Copy
public int Height { get; set; }
Property Value
Type Description
int
Remarks

The setter is deprecated in API8 and will be removed in API10. Use new Rectangle(...) constructor.

View Source

Width

The width of the rectangle.

Declaration
C#
Copy
public int Width { get; set; }
Property Value
Type Description
int
Remarks

The setter is deprecated in API8 and will be removed in API10. Use new Rectangle(...) constructor.

View Source

X

The x position of the rectangle.

Declaration
C#
Copy
public int X { get; set; }
Property Value
Type Description
int
Remarks

The setter is deprecated in API8 and will be removed in API10. Use new Rectangle(...) constructor.

View Source

Y

The Y position of the rectangle.

Declaration
C#
Copy
public int Y { get; set; }
Property Value
Type Description
int
Remarks

The setter is deprecated in API8 and will be removed in API10. Use new Rectangle(...) constructor.

Methods

View Source

Area()

Gets the area of the rectangle.

Declaration
C#
Copy
public int Area()
Returns
Type Description
int

The area of the rectangle.

View Source

Bottom()

Gets the bottom of the rectangle.

Declaration
C#
Copy
public int Bottom()
Returns
Type Description
int

The bottom of the rectangle.

View Source

Contains(Rectangle)

Determines whether or not this rectangle contains the specified rectangle.

Declaration
C#
Copy
public bool Contains(Rectangle other)
Parameters
Type Name Description
Rectangle other

The other rectangle to test against this rectangle.

Returns
Type Description
bool

True if the specified rectangle is contained.

View Source

Equals(object)

Equality operator.

Declaration
C#
Copy
public override bool Equals(object o)
Parameters
Type Name Description
object o

The object to compare with the current object.

Returns
Type Description
bool

True if boxes are exactly same.

Overrides
object.Equals(object)
View Source

GetHashCode()

Serves as the default hash function.

Declaration
C#
Copy
public override int GetHashCode()
Returns
Type Description
int

A hash code for the current object.

Overrides
object.GetHashCode()
View Source

Intersects(Rectangle)

Determines whether or not this rectangle and the specified rectangle intersect.

Declaration
C#
Copy
public bool Intersects(Rectangle other)
Parameters
Type Name Description
Rectangle other

The other rectangle to test against this rectangle.

Returns
Type Description
bool

True if the rectangles intersect.

View Source

IsEmpty()

Determines whether or not this rectangle is empty.

Declaration
C#
Copy
public bool IsEmpty()
Returns
Type Description
bool

True if width or height are zero.

View Source

Left()

Gets the left of the rectangle.

Declaration
C#
Copy
public int Left()
Returns
Type Description
int

The left edge of the rectangle.

View Source

Right()

Gets the right of the rectangle.

Declaration
C#
Copy
public int Right()
Returns
Type Description
int

The right edge of the rectangle.

View Source

Set(int, int, int, int)

Assignment from individual values.

Declaration
C#
Copy
public void Set(int newX, int newY, int newWidth, int newHeight)
Parameters
Type Name Description
int newX

The x coordinate.

int newY

The y coordinate.

int newWidth

The width.

int newHeight

The height.

View Source

Top()

Gets the top of the rectangle.

Declaration
C#
Copy
public int Top()
Returns
Type Description
int

The top of the rectangle.

Operators

View Source

operator ==(Rectangle, Rectangle)

THe Equality operator.

Declaration
C#
Copy
public static bool operator ==(Rectangle a, Rectangle b)
Parameters
Type Name Description
Rectangle a

The first operand.

Rectangle b

The second operand.

Returns
Type Description
bool

True if the boxes are exactly the same.

View Source

operator !=(Rectangle, Rectangle)

Inequality operator.

Declaration
C#
Copy
public static bool operator !=(Rectangle a, Rectangle b)
Parameters
Type Name Description
Rectangle a

The first rectangle.

Rectangle b

The second rectangle.

Returns
Type Description
bool

True if the rectangles are not identical.

Implements

System.IDisposable
System.ICloneable