Skip to content

Class GraphicsWindow

Kristian Virtanen edited this page Oct 28, 2024 · 3 revisions

Description:

The GraphicsWindow class provides functionality for creating, customizing, and managing a graphical window. You can control its properties, such as background color, dimensions, resizability, and draw shapes and text on it. The class also includes event handling for key and mouse actions within the graphics window.

Properties

GraphicsWindow.BackgroundColor

  • Description: Gets or sets the background color of the graphics window. The color should be a valid color name.
  • Difference from orig. SB: none.

GraphicsWindow.BrushColor

  • Description: Gets or sets the brush color used for filling shapes. The color should be a valid color name.
  • Difference from orig. SB: none.

GraphicsWindow.CanResize

  • Description: Gets or sets a value indicating whether the graphics window is resizable.
  • Difference from orig. SB: Original expects a string "True" or "False" while SBOE expects boolean true or false.

GraphicsWindow.FontBold

  • Description: Gets or sets a value indicating whether bold text is used in the graphics window.
  • Difference from orig. SB: Original expects a string "True" or "False" while SBOE expects boolean true or false.

GraphicsWindow.FontItalic

  • Description: Gets or sets a value indicating whether italic text is used in the graphics window.
  • Difference from orig. SB: Original expects a string "True" or "False" while SBOE expects boolean true or false.

GraphicsWindow.FontName

  • Description: Gets or sets the name of the font used for drawing text.
  • Difference from orig. SB: none.

GraphicsWindow.FontSize

  • Description: Gets or sets the size of the font used for drawing text.
  • Difference from orig. SB: none.

GraphicsWindow.Height

  • Description: Gets or sets the height of the graphics window in pixels.
  • Difference from orig. SB: none.

GraphicsWindow.LastError

  • Description: Stores the last error message, if any operation fails, including a timestamp in yyyy-MM-dd HH:mm:ss format.
  • Difference from orig. SB: Not available at orig. SB.

GraphicsWindow.LastKey

  • Description: Stores the last key pressed while GraphicsWindow has been open.
  • Difference from orig. SB: none.

GraphicsWindow.LastText

  • Description: Stores the last text typed (seperator is ENTER) while GraphicsWindow has been open.
  • Difference from orig. SB: none.

GraphicsWindow.PenColor

  • Description: Gets or sets the pen color for drawing shapes. The color should be a valid color name.
  • Difference from orig. SB: none.

GraphicsWindow.PenWidth

  • Description: Gets or sets the width of the pen used for drawing shapes.
  • Difference from orig. SB: none.

GraphicsWindow.Width

  • Description: Gets or sets the width of the graphics window in pixels.
  • Difference from orig. SB: none.

Events

GraphicsWindow.KeyDown

  • Description: Occurs when a key is pressed while the graphics window has focus.
  • Difference from orig. SB: none.

GraphicsWindow.KeyUp

  • Description: Occurs when a key is released while the graphics window has focus.
  • Difference from orig. SB: none.

GraphicsWindow.MouseDown

  • Description: Occurs when the mouse button is pressed down in the graphics window.
  • Difference from orig. SB: none.

GraphicsWindow.MouseMove

  • Description: Occurs when the mouse is moved within the graphics window.
  • Difference from orig. SB: none.

GraphicsWindow.MouseUp

  • Description: Occurs when the mouse button is released in the graphics window.
  • Difference from orig. SB: none.

Methods

GraphicsWindow.Clear()

  • Description: Clears the graphics window, resetting it to the background color.
  • Returns: true if the window was cleared successfully, false if an error occurred.
  • Difference from orig. SB: Original is void and returns nothing while SBOE uses Clear as boolean function and returns true or false.

GraphicsWindow.Show()

  • Description: Displays the graphics window and initializes it if it hasn't been created yet.
  • Returns: true if successful, false if an error occurred.
  • Difference from orig. SB: Original is void and returns nothing while SBOE uses Show as boolean function and returns true or false.

GraphicsWindow.Hide()

  • Description: Hides the graphics window.
  • Returns: true if successful, false if an error occurred.
  • Difference from orig. SB: Original is void and returns nothing while SBOE uses Hide as boolean function and returns true or false.

GraphicsWindow.DrawEllipse(x, y, width, height)

  • Description: Draws an ellipse at the specified coordinates (x, y) with the given width and height.
  • Parameters:
    • x: The horizontal position of the ellipse.
    • y: The vertical position of the ellipse.
    • width: The width of the ellipse.
    • height: The height of the ellipse.
  • Returns: true if the ellipse was drawn successfully, false if an error occurred.
  • Difference from orig. SB: Original is void and returns nothing while at SBOE it is a boolean function and returns true or false.

GraphicsWindow.FillEllipse(x, y, width, height)

  • Description: Fills an ellipse at the specified coordinates (x, y) with the given width and height using the current brush color.
  • Parameters:
    • x: The horizontal position of the ellipse.
    • y: The vertical position of the ellipse.
    • width: The width of the ellipse.
    • height: The height of the ellipse.
  • Returns: true if the ellipse was filled successfully, false if an error occurred.
  • Difference from orig. SB: Original is void and returns nothing while at SBOE it is a boolean function and returns true or false.

GraphicsWindow.DrawRectangle(x, y, width, height)

  • Description: Draws a rectangle at the specified coordinates (x, y) with the given width and height.
  • Parameters:
    • x: The horizontal position of the rectangle.
    • y: The vertical position of the rectangle.
    • width: The width of the rectangle.
    • height: The height of the rectangle.
  • Returns: true if the rectangle was drawn successfully, false if an error occurred.
  • Difference from orig. SB: Original is void and returns nothing while at SBOE it is a boolean function and returns true or false.

GraphicsWindow.FillRectangle(x, y, width, height)

  • Description: Fills a rectangle at the specified coordinates (x, y) with the given width and height using the current brush color.
  • Parameters:
    • x: The horizontal position of the rectangle.
    • y: The vertical position of the rectangle.
    • width: The width of the rectangle.
    • height: The height of the rectangle.
  • Returns: true if the rectangle was filled successfully, false if an error occurred.
  • Difference from orig. SB: Original is void and returns nothing while at SBOE it is a boolean function and returns true or false.

`GraphicsWindow.DrawTriangle(x1, y1, x2, y2, x3, y3)

  • Description: Draws a triangle which corners are passed as parameters.
  • Parameters:
    • x1, x2, x3: The horizontal positions of the triangle
    • y1, y2, y3: The vertical positions of the triangle.
  • Returns: true if the triangle was drawn successfully, false if an error occurred.
  • Difference from orig. SB: Original is void and returns nothing while at SBOE it is a boolean function and returns true or false.

`GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3)

  • Description: Fills a triangle which corners are passed as parameters.
  • Parameters:
    • x1, x2, x3: The horizontal positions of the triangle
    • y1, y2, y3: The vertical positions of the triangle.
  • Returns: true if the triangle was filled successfully, false if an error occurred.
  • Difference from orig. SB: Original is void and returns nothing while at SBOE it is a boolean function and returns true or false.

`GraphicsWindow.DrawLine(x1, y1, x2, y2)

  • Description: Draws a line.
  • Parameters:
    • x1, y1: Starting point of line.
    • x2, y2: End point of line.
  • Returns: true if the line was drawn successfully, false if an error occurred.
  • Difference from orig. SB: Original is void and returns nothing while at SBOE it is a boolean function and returns true or false.

GraphicsWindow.DrawText(x, y, text)

  • Description: Draws the specified text at the given coordinates (x, y) using the current font and pen color.
  • Parameters:
    • x: The horizontal position of the text.
    • y: The vertical position of the text.
    • text: The string of text to draw.
  • Returns: true if the text was drawn successfully, false if an error occurred.
  • Difference from orig. SB: Original is void and returns nothing while at SBOE it is a boolean function and returns true or false.

`GraphicsWindow.DrawBoundText(x, y, width, text)

  • Description: Draws the specified text at the given coordinates (x, y) using the current font and pen color.
  • Parameters:
    • x: The horizontal start position of the text.
    • y: The vertical start position of the text.
    • width: The max width on single line.
    • text: The string of text to draw.
  • Returns: true if the text was drawn successfully, false if an error occurred.
  • Difference from orig. SB: Original is void and returns nothing while at SBOE it is a boolean function and returns true or false.

Top

Clone this wiki locally