Class Rectangle
Definition
- 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.
public class Rectangle : Disposable, IDisposable, ICloneable
- Inheritance
- Implements
-
System.IDisposableSystem.ICloneable
Constructors
View SourceRectangle()
The default constructor of Rectangle class.
Declaration
public Rectangle()
Rectangle(int, int, int, int)
The constructor.
Declaration
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 SourceHeight
The height of the rectangle.
Declaration
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.
Width
The width of the rectangle.
Declaration
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.
X
The x position of the rectangle.
Declaration
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.
Y
The Y position of the rectangle.
Declaration
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 SourceArea()
Gets the area of the rectangle.
Declaration
public int Area()
Returns
| Type | Description |
|---|---|
| int | The area of the rectangle. |
Bottom()
Gets the bottom of the rectangle.
Declaration
public int Bottom()
Returns
| Type | Description |
|---|---|
| int | The bottom of the rectangle. |
Contains(Rectangle)
Determines whether or not this rectangle contains the specified rectangle.
Declaration
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. |
Equals(object)
Equality operator.
Declaration
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
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for the current object. |
Overrides
Intersects(Rectangle)
Determines whether or not this rectangle and the specified rectangle intersect.
Declaration
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. |
IsEmpty()
Determines whether or not this rectangle is empty.
Declaration
public bool IsEmpty()
Returns
| Type | Description |
|---|---|
| bool | True if width or height are zero. |
Left()
Gets the left of the rectangle.
Declaration
public int Left()
Returns
| Type | Description |
|---|---|
| int | The left edge of the rectangle. |
Right()
Gets the right of the rectangle.
Declaration
public int Right()
Returns
| Type | Description |
|---|---|
| int | The right edge of the rectangle. |
Set(int, int, int, int)
Assignment from individual values.
Declaration
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. |
Top()
Gets the top of the rectangle.
Declaration
public int Top()
Returns
| Type | Description |
|---|---|
| int | The top of the rectangle. |
Operators
View Sourceoperator ==(Rectangle, Rectangle)
THe Equality operator.
Declaration
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. |
operator !=(Rectangle, Rectangle)
Inequality operator.
Declaration
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. |