-
Notifications
You must be signed in to change notification settings - Fork 0
Class Shapes
Kristian Virtanen edited this page Oct 16, 2024
·
2 revisions
The Shapes class provides methods to create and manipulate shapes in the GraphicsWindow, including rectangles, ellipses, triangles, lines, and images. The class also provides functionality for rotating and resizing (zooming) shapes. Error handling is included via the LastError property, which stores the most recent error message if an operation fails.
-
Description: Stores the last error message, if any operation fails, including a timestamp in
yyyy-MM-dd HH:mm:ssformat. -
Example:
"2024-10-16 14:30:00: Shape with name Shape1 not found."
-
Description: Adds a rectangle to the
GraphicsWindowwith the specified width and height. -
Parameters:
-
width: The width of the rectangle. -
height: The height of the rectangle.
-
-
Returns: The name of the created rectangle shape, or
nullif an error occurred.
-
Description: Adds an ellipse to the
GraphicsWindowwith the specified width and height. -
Parameters:
-
width: The width of the ellipse. -
height: The height of the ellipse.
-
-
Returns: The name of the created ellipse shape, or
nullif an error occurred.
-
Description: Adds a triangle to the
GraphicsWindowdefined by three sets of coordinates. -
Parameters:
-
x1,y1: Coordinates of the first point. -
x2,y2: Coordinates of the second point. -
x3,y3: Coordinates of the third point.
-
-
Returns: The name of the created triangle shape, or
nullif an error occurred.
-
Description: Adds a line to the
GraphicsWindowdefined by two sets of coordinates. -
Parameters:
-
x1,y1: Coordinates of the start point. -
x2,y2: Coordinates of the end point.
-
-
Returns: The name of the created line shape, or
nullif an error occurred.
-
Description: Adds an image to the
GraphicsWindowusing the specified image name from theImageList. -
Parameters:
-
imageName: The name of the image in theImageList.
-
-
Returns: The name of the created image shape, or
nullif the image is not found or an error occurs.
- Description: Rotates the specified shape or image by the given angle.
-
Parameters:
-
shapeName: The name of the shape or image to rotate. -
angle: The angle in degrees to rotate.
-
-
Returns:
trueif successful,falseif an error occurs (e.g., the shape is not found).
- Description: Resizes (zooms) the specified shape by scaling its width and height.
-
Parameters:
-
shapeName: The name of the shape to resize. -
scaleX: The scale factor for the width. -
scaleY: The scale factor for the height.
-
-
Returns:
trueif successful,falseif an error occurs (e.g., the shape is not found).