A Rectangle variable is a structured type that is used to represent a rectangle (X, Y, Width, Height) in 2 dimensions.
MyRectangle is Rectangle MyRectangle .X = 280 MyRectangle .Y = 54 MyRectangle .Width = 50 MyRectangle .Height = 150
Syntax
Declaring and initializing a rectangle Hide the details
<Rectangle Name> is Rectangle
<Rectangle Name>:
Name of the Rectangle variable to declare. Properties
WLanguage properties that can be used with the Rectangle type
The initial value of a rectangle is set to (0,0,0,0).
The following properties can be used to handle Rectangle variables:
Property name Effect Height Height of the rectangle. This coordinate corresponds to a 4-byte signed integer. Width Width of the rectangle. This coordinate corresponds to a 4-byte signed integer. X X-coordinate of the top left point. This coordinate corresponds to a 4-byte signed integer. Y Y-coordinate of the top left point. This coordinate corresponds to a 4-byte signed integer.
Remarks
Assigning a Rectangle variable
A Rectangle variable can be assigned with:
another Rectangle variable. For example: MyRectangle is Rectangle MyRectangle .X = 280 MyRectangle .Y = 54 MyRectangle .Width = 50 MyRectangle .Height = 150 MyRectangle1 is Rectangle = MyRectangle
an array of four values that can be converted into integer. For example: MyRectangle is Rectangle MyRectangle = [ 280 , 54 , 50 , 150 ]
two Point variables (corresponding respectively to the upper-left corner and to the lower-right corner of the rectangle). For example: MyRectangle is Rectangle MyRectangle = [[ 280 , 54 ], [ 330 , 204 ]]
Assigning an array of Rectangles
An array of rectangles can be assigned with:
an array of values containing rectangles. For example: ArrayOfRectangles is array of Rectangles ArrayOfRectangles = [ MyRectangle1 , MyRectangle2 ]
an array of four values that can be converted into integer. For example: ArrayOfRectangles is array of Rectangles ArrayOfRectangles = [[ 1 , 2 , 3 , 4 ], [ 5 , 6 , 7 , 8 ]
Comparison and serialization
Comparison: The = and <> comparison operators are available. Serialization: The binary, XML and JSON serializations are available. Caution: In an XML serialization, the xmlAttribute constant cannot be used on a structure or class member of type Rectangle. Notes
A Rectangle variable can be stored in a variant. A Rectangle variable is never null: The "RectangleVariable = NULL" condition always returns False . The "RectangleVariable <> NULL" condition always returns True . You cannot reference a Rectangle variable. The "RectangleVariable2 <- RectangleVariable1" syntax triggers an error. You cannot force the copy of a Rectangle variable. The "RectangleVariable2 <= RectangleVariable1" syntax triggers an error. You have the ability to add a Point variable and a Rectangle variable. This operation is used to perform a relocation of the rectangle. You have the ability to subtract a Point variable to a Rectangle variable. This operation is used to perform a relocation of the rectangle. The Rectangle variables can be passed to the system APIs.