Class Rectangle
A rectangle (size and origin).
Inheritance
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class Rectangle
Constructors
Rectangle()
Initializes a new instance of the Rectangle class.
Declaration
public Rectangle()
Rectangle(Point, Size)
Initializes a new instance of the Rectangle class.
Declaration
public Rectangle(Point origin, Size size)
Parameters
Type | Name | Description |
---|---|---|
Point | origin | The origin. |
Size | size | The size. |
Properties
Empty
Gets the empty rectangle (0,0/0x0).
Declaration
public static Rectangle Empty { get; }
Property Value
Type | Description |
---|---|
Rectangle |
Height
Gets the size height.
Declaration
public int Height { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Origin
Gets or sets the origin.
Declaration
public Point Origin { get; set; }
Property Value
Type | Description |
---|---|
Point |
Size
Gets or sets the size.
Declaration
public Size Size { get; set; }
Property Value
Type | Description |
---|---|
Size |
Width
Gets the size width.
Declaration
public int Width { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
X
Gets the origin X coordinate.
Declaration
public int X { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Y
Gets the origin Y coordinate.
Declaration
public int Y { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Equals(Rectangle)
Determines whether the specified rectangle is equivalent to the current rectangle. Does not require the object pointers to match.
Declaration
public bool Equals(Rectangle rectangle)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rectangle | The rectangle to compare with the current object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified rectangle is equivalent to the current rectangle; otherwise, false. |
Equals(Object)
Determines whether the specified object is equivalent to the current rectangle. Does not require the object pointers to match.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified object is equivalent to the current object; otherwise, false. |
Overrides
FromJson(String)
Deserializes an instance from JSON.
Declaration
public static Rectangle FromJson(string rectangleJson)
Parameters
Type | Name | Description |
---|---|---|
System.String | rectangleJson | The JSON to deserialize. |
Returns
Type | Description |
---|---|
Rectangle | The deserialized rectangle. |
FromStruct(Rectangle)
Converts a System.Drawing.Rectangle to a Rectangle.
Declaration
public static Rectangle FromStruct(Rectangle rectangle)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Rectangle | rectangle |
Returns
Type | Description |
---|---|
Rectangle |
GetHashCode()
Gets a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code. |
Overrides
IsEquivalent(Rectangle)
Determines whether the specified rectangle is equivalent.
Declaration
public bool IsEquivalent(Rectangle rectangle)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rectangle | The rectangle. |
Returns
Type | Description |
---|---|
System.Boolean |
IsEquivalent(Rectangle, Rectangle)
Determines whether the two rectangles are equivalent.
Declaration
public static bool IsEquivalent(Rectangle rectangle1, Rectangle rectangle2)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rectangle1 | The first rectangle. |
Rectangle | rectangle2 | The second rectangle. |
Returns
Type | Description |
---|---|
System.Boolean |
ToJson()
Serializes this instance to JSON.
Declaration
public string ToJson()
Returns
Type | Description |
---|---|
System.String | The serialized JSON. |
ToJson(Rectangle)
Serializes an instance to JSON.
Declaration
public static string ToJson(Rectangle rectangle)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rectangle | The rectangle. |
Returns
Type | Description |
---|---|
System.String | The serialized JSON. |
ToString()
Returns a string that represents this instance using format "{origin}/{size}".
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
ToStruct()
Converts this Rectangle to a System.Drawing.Rectangle.
Declaration
public Rectangle ToStruct()
Returns
Type | Description |
---|---|
System.Drawing.Rectangle |
ToStruct(Rectangle)
Converts a Rectangle to a System.Drawing.Rectangle.
Declaration
public static Rectangle ToStruct(Rectangle rectangle)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rectangle |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle |
Operators
Equality(Rectangle, Rectangle)
Determines whether the specified rectangle is equivalent to the current rectangle. Does not require the object pointers to match.
Declaration
public static bool operator ==(Rectangle rectangle1, Rectangle rectangle2)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rectangle1 | The first rectangle. |
Rectangle | rectangle2 | The second rectangle. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified rectangle is equivalent to the current rectangle; otherwise, false. |
Inequality(Rectangle, Rectangle)
Determines whether the specified rectangle is NOT equivalent to the current rectangle.
Declaration
public static bool operator !=(Rectangle rectangle1, Rectangle rectangle2)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rectangle1 | The first rectangle. |
Rectangle | rectangle2 | The second rectangle. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified rectangle is NOT equivalent to the current rectangle; otherwise, false. |