public class Rectangle
implements IPersistable, IConstructable
The Rectangle class is similar to a Win32 RECT structure. The Rectangle class also includes member functions to manipulate Rectangle objects and Win32 RECT structures. A Rectangle object also contains member variables that define the top, left, bottom, and right points of a rectangle.
Fields
Name | Description |
---|---|
height | Stores the height of the rectangle. |
width | Stores the width of the rectangle. |
x | Stores the x-position (or horizontal origin) of the rectangle. |
y | Stores the y-position (or vertical origin) of the rectangle. |
Constructors
Name | Description |
---|---|
Rectangle() | Constructs a Rectangle object. |
Rectangle(IDataStream stream) | Constructs a Rectangle object and initializes the object from a data stream. |
Rectangle(Rectangle r) | Constructs a Rectangle object and initializes it to the specified Rectangle's settings. |
Rectangle(int x, int y, int width, int height) | Constructs a Rectangle object and initializes it to the settings contained in the specified Rectangle object. |
Rectangle(RECT rect) | Constructs a Rectangle object and initializes it to the settings stored in a Win32 RECT. |
Methods
Name | Description |
---|---|
contains(Point pt) | Retrieves a boolean value that indicates whether this rectangle contains the specified points. |
contains(int x, int y) | Retrieves a boolean value that indicates whether this rectangle contains the specified points. |
contains(Rectangle rect) | Retrieves a boolean value that indicates whether the specified rectangle is less than or equal to this one. |
equals(Object obj) | Retrieves a boolean value that indicates whether the specified object is identical to this rectangle. |
getBottom() | Returns the lowest point in the rectangle's y-axis. |
getConstructorArgs() | Topic under construction. |
getExtension() | Because the Rectangle object is not a file-based object, this method always returns null. |
getRight() | Retrieves the right-most point on the rectangle's x-axis. |
hashCode() | Topic under construction. |
inflateRect(int x, int y) | Expands the size of the rectangle using the specified x and y values. |
intersectRect(Rectangle lpRect1, Rectangle lpRect2) | Retrieves a boolean value that indicates whether two rectangles intersect. |
intersectsWith(Rectangle rect) | Retrieves a boolean value that indicates whether the specified rectangle intersects with this one. |
save(IDataStream stream) | Saves this object's settings to a data stream. |
setBounds(int x, int y, int width, int height) | Initializes this Rectangle object. |
setBounds(RECT r) | Copies the specified values to this Rectangle object. |
setBounds(Rectangle r) | Copies the specified Rectangle object to this rectangle. |
toRECT() | Retrieves a Win32 RECT structure that contains the settings of this Rectangle object. |
toRECT(Rectangle r) | Retrieves a Win32 RECT structure that contains the settings of the specified Rectangle object. |
toString() | Retrieves a String representation of this object. |
Constructs a Rectangle object.
Constructs a Rectangle object and initializes the object from a data stream.
Constructs a Rectangle object and initializes it to the specified Rectangle's settings.
Constructs a Rectangle object and initializes it to the settings contained in the specified Rectangle object.
Constructs a Rectangle object and initializes it to the settings stored in a Win32 RECT.
Returns true if this rectangle contains the specified coordinates; otherwise, returns false.
Retrieves a boolean value that indicates whether this rectangle contains the specified points. The x and y parameters in the pt parameter must be less than or equal to the x and y positions in the rectangle. In addition, the point's x value must be less than the rectangle's width and the point's y value must be less than the rectangle's height.
Returns true, if the Rectangle contains the specified coordinates; otherwise, returns false.
Retrieves a boolean value that indicates whether this rectangle contains the specified points. The specified x and y parameters must be less than or equal to the x and y coordinates in the rectangle. In addition, the x and y parameters must be less than the width and height of the rectangle, respectively.
Returns true if this rectangle contains the coordinates stored in the specified rectangle; otherwise, returns false.
Retrieves a boolean value that indicates whether the specified rectangle is less than or equal to this one.
Returns true if the objects are equivalent; otherwise, returns false.
Retrieves a boolean value that indicates whether the specified object is identical to this rectangle. The specified object must be a Rectangle object instance.
Returns the lowest point in the rectangle's y-axis. This value equates to the sum of the rectangle's y-coordinate and its height.
Returns the lowest point in the rectangle's y-axis.
Topic under construction.
Returns null.
Because the Rectangle object is not a file-based object, this method always returns null.
Returns the right-most point on the rectangle's x-axis. This value equates to the sum of the rectangle's x-coordinate and its width.
Retrieves the right-most point on the rectangle's x-axis.
Topic under construction.
Expands the size of the rectangle using the specified x and y values. The inflateRect method formulates the new x and y coordinates by subtracting the value of the x and y parameters from the current value of the rectangle's x and y coordinates. The new width of the rectangle is formulated by adding the product of x and 2 to the current width. The new height is formulated by adding the product of y and 2 to the current height.
Returns true if the rectangles intersect; otherwise, returns false.
Retrieves a boolean value that indicates whether two rectangles intersect.
Returns true if the rectangles intersect; otherwise, returns false.
Retrieves a boolean value that indicates whether the specified rectangle intersects with this one.
Saves this object's settings to a data stream.
Initializes this Rectangle object.
Copies the specified values to this Rectangle object.
Copies the specified Rectangle object to this rectangle.
Returns a Win32 RECT structure that contains this rectangle's current values.
Retrieves a Win32 RECT structure that contains the settings of this Rectangle object.
Returns a Win32 RECT structure that contains the specified rectangle's settings.
Retrieves a Win32 RECT structure that contains the settings of the specified Rectangle object.
Returns a String representation of this Rectangle object.
Retrieves a String representation of this object.