Microsoft Small Basic

Program Listing: RBV666
'Interface
GraphicsWindow.Width = 700
GraphicsWindow.Height = 500
GraphicsWindow.CanResize = "False"
GraphicsWindow.DrawRectangle(5,5,700,369)
GraphicsWindow.DrawRectangle(5,380,150,120)
GraphicsWindow.DrawRectangle(160,380,400,120)
GraphicsWindow.DrawRectangle(565,380,140,120)
GUI()
Sub GUI
rectangle = Controls.AddButton("Rectangle",25,385)
Controls.SetSize(rectangle,100,28)
circle = Controls.AddButton("Circle",25,420)
Controls.SetSize(circle,100,28)
triangle = Controls.AddButton("Triangle",25,455)
Controls.SetSize(triangle,100,28)
zoom = Controls.AddButton("Zoom",230,420)
Controls.SetSize(zoom,70,50)
rotate = Controls.AddButton("Rotate",315,420)
Controls.SetSize(rotate,70,50)
draw = Controls.AddButton("Draw",400,420)
Controls.SetSize(draw,70,50)
exit = Controls.AddButton("Exit",600,420)
Controls.SetSize(exit,70,50)
EndSub
Controls.ButtonClicked = mouseaction
Sub mouseaction
x = GraphicsWindow.MouseX
y = GraphicsWindow.MouseY
GraphicsWindow.PenWidth = 1
If x > 40 And x < 160 Then
GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor()
If y > 345 And y < 375 Then
draw = 0
j = 0
z = 1
tri = Shapes.AddTriangle(20,20,100,100,150,20)
Shapes.Move(tri,80,100)
EndIf
If y>375 And y<405 Then
draw = 0
j = 0
z = 2
rect = Shapes.AddRectangle(100,100)
Shapes.Move(rect,250,250)
EndIf
If y>405 And y<435 Then
draw = 0
j = 0
z = 3
circ = Shapes.AddEllipse(100,100)
Shapes.Move(circ,400,150)
EndIf
EndIf
If y>360 And y<420 Then
If x>230 And x<290 Then
draw = 0
If z=1 Then
Shapes.Rotate(tri,30 + m)
Else
If z = 2 Then
Shapes.Rotate(rect,30+m)
Else
If z=3 Then
Shapes.Rotate(circ,30+m)
EndIf
EndIf
EndIf
m = m+30
EndIf
If x>290 And x<390 Then
draw = 0
i = 0.1 +j
If i<0.4 Then
If z = 1 Then
Shapes.Zoom(tri,1+i,1+i)
Else
If z = 2 Then
Shapes.Zoom(rect,1+i,1+i)
Else
If z = 3 Then
Shapes.Zoom(circ,1+i,1+i)
EndIf
EndIf
EndIf
j =j+0.1
EndIf
EndIf
If x>390 And x<450 Then
draw=1
Paint()
EndIf
If x>450 And x<510 Then
draw=0
j=0
GraphicsWindow.Clear()
GraphicsWindow.BrushColor = "Blue"
GUI()
draw = 0
Program.End()
EndIf
EndIf
EndSub
Sub Paint
If draw = 1 Then
GraphicsWindow.MouseMove = Mousedrag
Else
If Mouse.IsLeftButtonDown Then
mouseaction()
EndIf
EndIf
EndSub

Sub Mousedrag
If draw = 1 Then
x = GraphicsWindow.MouseX
y = GraphicsWindow.MouseY
If x>10 And x<600 And y>10 And y<320 Then
If Mouse.IsLeftButtonDown Then
GraphicsWindow.DrawLine(orgx,orgy,x,y)
EndIf
EndIf
orgx = x
orgy = y
EndIf
EndSub