Small Basic Reference Documentation: GraphicsWindow Object
Small Basic: Reference Documentation > GraphicsWindow
http://smallbasic.com/img/object_32.png
GraphicsWindow
The GraphicsWindow provides graphics related input and output functionality. For example, using this class, it is possible to draw and fill circles and rectangles.
Properties
http://smallbasic.com/img/property_16.png BackgroundColor
GraphicsWindow.BackgroundColor
Gets or sets the Background color of the Graphics Window.
http://smallbasic.com/img/property_16.png BrushColor
GraphicsWindow.BrushColor
Gets or sets the brush color to be used to fill shapes drawn on the Graphics Window.
http://smallbasic.com/img/property_16.png CanResize
GraphicsWindow.CanResize
Specifies whether or not the Graphics Window can be resized by the user.
http://smallbasic.com/img/property_16.png PenWidth
GraphicsWindow.PenWidth
Gets or sets the width of the pen used to draw shapes on the Graphics Window.
http://smallbasic.com/img/property_16.png PenColor
GraphicsWindow.PenColor
Gets or sets the color of the pen used to draw shapes on the Graphics Window.
http://smallbasic.com/img/property_16.png FontName
GraphicsWindow.FontName
Gets or sets the Font Name to be used when drawing text on the Graphics Window.
http://smallbasic.com/img/property_16.png FontSize
GraphicsWindow.FontSize
Gets or sets the Font Size to be used when drawing text on the Graphics Window.
http://smallbasic.com/img/property_16.png FontBold
GraphicsWindow.FontBold
Gets or sets whether or not the font to be used when drawing text on the Graphics Window, is bold.
http://smallbasic.com/img/property_16.png FontItalic
GraphicsWindow.FontItalic
Gets or sets whether or not the font to be used when drawing text on the Graphics Window, is italic.
http://smallbasic.com/img/property_16.png Title
GraphicsWindow.Title
Gets or sets the title for the graphics window.
http://smallbasic.com/img/property_16.png Height
GraphicsWindow.Height
Gets or sets the Height of the graphics window.
http://smallbasic.com/img/property_16.png Width
GraphicsWindow.Width
Gets or sets the Width of the graphics window.
http://smallbasic.com/img/property_16.png Left
GraphicsWindow.Left
Gets or sets the Left Position of the graphics window.
http://smallbasic.com/img/property_16.png Top
GraphicsWindow.Top
Gets or sets the Top Position of the graphics window.
http://smallbasic.com/img/property_16.png LastKey (This property is read-only.)
GraphicsWindow.LastKey
Gets the last key that was pressed or released.
http://smallbasic.com/img/property_16.png LastText (This property is read-only.)
GraphicsWindow.LastText
Gets the last text that was entered on the Graphics Window.
http://smallbasic.com/img/property_16.png MouseX (This property is read-only.)
GraphicsWindow.MouseX
Gets the x-position of the mouse relative to the Graphics Window.
http://smallbasic.com/img/property_16.png MouseY (This property is read-only.)
GraphicsWindow.MouseY
Gets the y-position of the mouse relative to the Graphics Window.
Events
http://smallbasic.com/img/event_16.png KeyDown
GraphicsWindow.KeyDown
Raises an event when a key is pressed down on the keyboard.
http://smallbasic.com/img/event_16.png KeyUp
GraphicsWindow.KeyUp
Raises an event when a key is released on the keyboard.
http://smallbasic.com/img/event_16.png MouseDown
GraphicsWindow.MouseDown
Raises an event when the mouse button is clicked down.
http://smallbasic.com/img/event_16.png MouseUp
GraphicsWindow.MouseUp
Raises an event when the mouse button is released.
http://smallbasic.com/img/event_16.png MouseMove
GraphicsWindow.MouseMove
Raises an event when the mouse is moved around.
http://smallbasic.com/img/event_16.png TextInput
GraphicsWindow.TextInput
Raises an event when text is entered on the GraphicsWindow.
Operations
http://smallbasic.com/img/method_16.png Show
GraphicsWindow.Show()
Shows the Graphics window to enable interactions with it.
Returns
Nothing
http://smallbasic.com/img/method_16.png Hide
GraphicsWindow.Hide()
Hides the Graphics window.
Returns
Nothing
http://smallbasic.com/img/method_16.png DrawRectangle
GraphicsWindow.DrawRectangle(x, y, width, height)
Draws a rectangle on the screen using the selected Pen.
x
The x co-ordinate of the rectangle.
y
The y co-ordinate of the rectangle.
width
The width of the rectangle.
height
The height of the rectangle.
Returns
Nothing
http://smallbasic.com/img/method_16.png FillRectangle
GraphicsWindow.FillRectangle(x, y, width, height)
Fills a rectangle on the screen using the selected Brush.
x
The x co-ordinate of the rectangle.
y
The y co-ordinate of the rectangle.
width
The width of the rectangle.
height
The height of the rectangle.
Returns
Nothing
http://smallbasic.com/img/method_16.png DrawEllipse
GraphicsWindow.DrawEllipse(x, y, width, height)
Draws an ellipse on the screen using the selected Pen.
x
The x co-ordinate of the ellipse.
y
The y co-ordinate of the ellipse.
width
The width of the ellipse.
height
The height of the ellipse.
Returns
Nothing
http://smallbasic.com/img/method_16.png FillEllipse
GraphicsWindow.FillEllipse(x, y, width, height)
Fills an ellipse on the screen using the selected Brush.
x
The x co-ordinate of the ellipse.
y
The y co-ordinate of the ellipse.
width
The width of the ellipse.
height
The height of the ellipse.
Returns
Nothing
http://smallbasic.com/img/method_16.png DrawTriangle
GraphicsWindow.DrawTriangle(x1, y1, x2, y2, x3, y3)
Draws a triangle on the screen using the selected pen.
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
Nothing
http://smallbasic.com/img/method_16.png FillTriangle
GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3)
Draws and fills a triangle on the screen using the selected brush.
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
Nothing
http://smallbasic.com/img/method_16.png DrawLine
GraphicsWindow.DrawLine(x1, y1, x2, y2)
Draws a line from one point to another.
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
Nothing
http://smallbasic.com/img/method_16.png DrawText
GraphicsWindow.DrawText(x, y, text)
Draws a line of text on the screen at the specified location.
x
The x co-ordinate of the text start point.
y
The y co-ordinate of the text start point.
text
The text to draw
Returns
Nothing
http://smallbasic.com/img/method_16.png DrawBoundText
GraphicsWindow.DrawBoundText(x, y, width, text)
Draws a line of text on the screen at the specified location.
x
The x co-ordinate of the text start point.
y
The y co-ordinate of the text start point.
width
The maximum available width. This parameter helps define when the text should wrap.
text
The text to draw.
Returns
Nothing
http://smallbasic.com/img/method_16.png DrawResizedImage
GraphicsWindow.DrawResizedImage(imageName, x, y, width, height)
Draws the specified image from memory on to the screen, in the specified size.
imageName
The name of the image to draw
x
The x co-ordinate of the point to draw the image at.
y
The y co-ordinate of the point to draw the image at.
width
The width to draw the image.
height
The height to draw the image.
Returns
Nothing
http://smallbasic.com/img/method_16.png DrawImage
GraphicsWindow.DrawImage(imageName, x, y)
Draws the specified image from memory on to the screen.
imageName
The name of the image to draw.
x
The x co-ordinate of the point to draw the image at.
y
The y co-ordinate of the point to draw the image at.
Returns
Nothing
http://smallbasic.com/img/method_16.png SetPixel
GraphicsWindow.SetPixel(x, y, color)
Draws the pixel specified by the x and y co-ordinates using the specified color.
x
The x co-ordinate of the pixel.
y
The y co-ordinate of the pixel.
color
The color of the pixel to set.
Returns
Nothing
http://smallbasic.com/img/method_16.png GetPixel
GraphicsWindow.GetPixel(x, y)
Gets the color of the pixel at the specified x and y co-ordinates.
x
The x co-ordinate of the pixel.
y
The y co-ordinate of the pixel.
Returns
The color of the pixel.
http://smallbasic.com/img/method_16.png GetRandomColor
GraphicsWindow.GetRandomColor()
Gets a valid random color.
Returns
A valid random color.
http://smallbasic.com/img/method_16.png GetColorFromRGB
GraphicsWindow.GetColorFromRGB(red, green, blue)
Constructs a color given the Red, Green and Blue values.
red
The red component of the Color (0-255).
green
The green component of the color (0-255).
blue
The blue component of the color (0-255).
Returns
Returns a color that can be used to set the brush or pen color.
http://smallbasic.com/img/method_16.png Clear
GraphicsWindow.Clear()
Clears the window.
Returns
Nothing
http://smallbasic.com/img/method_16.png ShowMessage
GraphicsWindow.ShowMessage(text, title)
Displays a message box to the user.
text
The text to be displayed on the message box.
title
The title for the message box.
Returns
Nothing
See Also
- Small Basic Curriculum: Lesson 2.1: Graphics Window
- Small Basic Getting Started Guide: Chapter 6: Beginning Graphics
- Small Basic Reference Documentation: GraphicsWindow Object
- Small Basic: GraphicsWindow Basics
- Small Basic: Reference Documentation
- The Developer’s Reference Guide to Small Basic
- Wiki: Small Basic Portal