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

BackgroundColor

GraphicsWindow.BackgroundColor

Gets or sets the Background color of the Graphics Window.

BrushColor

GraphicsWindow.BrushColor

Gets or sets the brush color to be used to fill shapes drawn on the Graphics Window.

CanResize

GraphicsWindow.CanResize

Specifies whether or not the Graphics Window can be resized by the user.

PenWidth

GraphicsWindow.PenWidth

Gets or sets the width of the pen used to draw shapes on the Graphics Window.

PenColor

GraphicsWindow.PenColor

Gets or sets the color of the pen used to draw shapes on the Graphics Window.

FontName

GraphicsWindow.FontName

Gets or sets the Font Name to be used when drawing text on the Graphics Window.

FontSize

GraphicsWindow.FontSize

Gets or sets the Font Size to be used when drawing text on the Graphics Window.

FontBold

GraphicsWindow.FontBold

Gets or sets whether or not the font to be used when drawing text on the Graphics Window, is bold.

FontItalic

GraphicsWindow.FontItalic

Gets or sets whether or not the font to be used when drawing text on the Graphics Window, is italic.

Title

GraphicsWindow.Title

Gets or sets the title for the graphics window.

Height

GraphicsWindow.Height

Gets or sets the Height of the graphics window.

Width

GraphicsWindow.Width

Gets or sets the Width of the graphics window.

Left

GraphicsWindow.Left

Gets or sets the Left Position of the graphics window.

Top

GraphicsWindow.Top

Gets or sets the Top Position of the graphics window.

LastKey (This property is read-only.)

GraphicsWindow.LastKey

Gets the last key that was pressed or released.

LastText (This property is read-only.)

GraphicsWindow.LastText

Gets the last text that was entered on the Graphics Window.

MouseX (This property is read-only.)

GraphicsWindow.MouseX

Gets the x-position of the mouse relative to the Graphics Window.

MouseY (This property is read-only.)

GraphicsWindow.MouseY

Gets the y-position of the mouse relative to the Graphics Window.

Events

KeyDown

GraphicsWindow.KeyDown

Raises an event when a key is pressed down on the keyboard.

KeyUp

GraphicsWindow.KeyUp

Raises an event when a key is released on the keyboard.

MouseDown

GraphicsWindow.MouseDown

Raises an event when the mouse button is clicked down.

MouseUp

GraphicsWindow.MouseUp

Raises an event when the mouse button is released.

MouseMove

GraphicsWindow.MouseMove

Raises an event when the mouse is moved around.

TextInput

GraphicsWindow.TextInput

Raises an event when text is entered on the GraphicsWindow.

Operations

Show

GraphicsWindow.Show()

Shows the Graphics window to enable interactions with it.

Returns

Nothing

Hide

GraphicsWindow.Hide()

Hides the Graphics window.

Returns

Nothing

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

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

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

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

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

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

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

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

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

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

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

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

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.

GetRandomColor

GraphicsWindow.GetRandomColor()

Gets a valid random color.

Returns

A valid random color.

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.

Clear

GraphicsWindow.Clear()

Clears the window.

Returns

Nothing

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