Microsoft Small Basic

Program Listing: JNS945
color[ 0] = "Black"
color[ 1] = "Blue"
color[ 2] = "Cyan"
color[ 3] = "Gray"
color[ 4] = "Green"
color[ 5] = "Magenta"
color[ 6] = "Red"
color[ 7] = "White"
color[ 8] = "Yellow"
color[ 9] = "DarkBlue"
color[10] = "DarkCyan"
color[11] = "DarkGray"
color[12] = "DarkGreen"
color[13] = "DarkMagenta"
color[14] = "DarkRed"
color[15] = "DarkYellow"

color_total = 16

GraphicsWindow.BackgroundColor = "white"
GraphicsWindow.Title = "Graphics Window"
GraphicsWindow.Width = 1024
GraphicsWindow.Height = 768
GraphicsWindow.Show()
pixel_start = 0

For x = pixel_start To GraphicsWindow.Width
GraphicsWindow.PenColor = color[Math.Remainder(x, color_total)]
GraphicsWindow.DrawLine (x, pixel_start, GraphicsWindow.Width - x, GraphicsWindow.Height)
EndFor
For y = GraphicsWindow.Height - 1 To pixel_start - 1 Step -1
GraphicsWindow.PenColor = color[Math.Remainder(y, color_total)]
GraphicsWindow.DrawLine (pixel_start, y, GraphicsWindow.Width, GraphicsWindow.Height - y)
EndFor