Microsoft Small Basic


Shapes

The Shape object allows you to add, move and rotate shapes to the Graphics window.

Operations

AddRectangle

Shapes.AddRectangle(width, height)

Adds a rectangle shape with the specified width and height.

width

The width of the rectangle shape.

height

The height of the rectangle shape.

Returns

The Rectangle shape that was just added to the Graphics Window.

AddEllipse

Shapes.AddEllipse(width, height)

Adds an ellipse shape with the specified width and height.

width

The width of the ellipse shape.

height

The height of the ellipse shape.

Returns

The Ellipse shape that was just added to the Graphics Window.

AddTriangle

Shapes.AddTriangle(x1, y1, x2, y2, x3, y3)

Adds a triangle shape represented by the specified points.

x1

The x co-ordinate of the first point.

y1

The y co-ordinate of the first point.

x2

The x co-ordinate of the second point.

y2

The y co-ordinate of the second point.

x3

The x co-ordinate of the third point.

y3

The y co-ordinate of the third point.

Returns

The Triangle shape that was just added to the Graphics Window.

AddLine

Shapes.AddLine(x1, y1, x2, y2)

Adds a line between the specified points.

x1

The x co-ordinate of the first point.

y1

The y co-ordinate of the first point.

x2

The x co-ordinate of the second point.

y2

The y co-ordinate of the second point.

Returns

The line that was just added to the Graphics Window.

AddImage

Shapes.AddImage(imageName)

Adds an image as a shape that can be moved, animated or rotated.

imageName

The name of the image to draw.

Returns

The image that was just added to the Graphics Window.

AddText

Shapes.AddText(text)

Adds some text as a shape that can be moved, animated or rotated.

text

The text to add.

Returns

The text shape that was just added to the Graphics Window.

SetText

Shapes.SetText(shapeName, text)

Sets the text of a text shape.

shapeName

The name of the text shape.

text

The new text value to set.

Returns

Nothing

Remove

Shapes.Remove(shapeName)

Removes a shape from the Graphics Window.

shapeName

The name of the shape that needs to be removed.

Returns

Nothing

Move

Shapes.Move(shapeName, x, y)

Moves the shape with the specified name to a new position.

shapeName

The name of the shape to move.

x

The x co-ordinate of the new position.

y

The y co-ordinate of the new position.

Returns

Nothing

Rotate

Shapes.Rotate(shapeName, angle)

Rotates the shape with the specified name to the specified angle.

shapeName

The name of the shape to rotate.

angle

The angle to rotate the shape.

Returns

Nothing

Zoom

Shapes.Zoom(shapeName, scaleX, scaleY)

Scales the shape using the specified zoom levels. Minimum is 0.1 and maximum is 20.

shapeName

The name of the shape to rotate.

scaleX

The x-axis zoom level.

scaleY

The y-axis zoom level.

Returns

Nothing

Animate

Shapes.Animate(shapeName, x, y, duration)

Animates a shape with the specified name to a new position.

shapeName

The name of the shape to move.

x

The x co-ordinate of the new position.

y

The y co-ordinate of the new position.

duration

The time for the animation, in milliseconds.

Returns

Nothing

GetLeft

Shapes.GetLeft(shapeName)

Gets the left co-ordinate of the specified shape.

shapeName

The name of the shape.

Returns

The left co-ordinate of the shape.

GetTop

Shapes.GetTop(shapeName)

Gets the top co-ordinate of the specified shape.

shapeName

The name of the shape.

Returns

The top co-ordinate of the shape.

GetOpacity

Shapes.GetOpacity(shapeName)

Gets the opacity of a shape.

shapeName

The name of the shape.

Returns

The opacity of the object as a value between 0 and 100. 0 is completely transparent and 100 is completely opaque.

SetOpacity

Shapes.SetOpacity(shapeName, level)

Sets how opaque a shape should render.

shapeName

The name of the shape.

level

The opacity level ranging from 0 to 100. 0 is completely transparent and 100 is completely opaque.

Returns

Nothing

HideShape

Shapes.HideShape(shapeName)

Hides an already added shape.

shapeName

The name of the shape.

Returns

Nothing

ShowShape

Shapes.ShowShape(shapeName)

Shows a previously hidden shape.

shapeName

The name of the shape.

Returns

Nothing