Microsoft Small Basic

Program Listing: JRB927
GraphicsWindow.Title = "OEKAKI"
GraphicsWindow.Width = 640
GraphicsWindow.Height = 480

GraphicsWindow.MouseDown = OnMouseDown
GraphicsWindow.MouseMove = OnmouseMove

blackbotan = Controls.AddButton("black", 3, 4)
bluebotan = Controls.AddButton("blue", 50, 4)
redbotan = Controls.AddButton("red", 90, 4)
hosoibotan = Controls.AddButton("hosoi", 125, 4)
middlebotan = Controls.AddButton("middle", 170, 4)
futoibotan = Controls.AddButton("futoi", 225, 4)
clearbotan = Controls.AddButton("clear", 500, 4)

Sub OnMouseDown
prex = GraphicsWindow.MouseX
prey = GraphicsWindow.MouseY
EndSub

Sub OnmouseMove
x= GraphicsWindow.MouseX
y= GraphicsWindow.MouseY
If (Mouse.IsLeftButtonDown) Then
GraphicsWindow.DrawLine(prex, prey, x, y)
EndIf
prex = x
prey = y
EndSub

Controls.ButtonClicked = click

Sub click
If Controls.LastClickedButton = blackbotan Then
GraphicsWindow.PenColor = "black"
EndIf
If Controls.LastClickedButton = bluebotan Then
GraphicsWindow.PenColor = "blue"
EndIf
If Controls.LastClickedButton = redbotan Then
GraphicsWindow.PenColor = "red"
EndIf
If Controls.LastClickedButton = hosoibotan Then
GraphicsWindow.PenWidth = 1
EndIf
If Controls.LastClickedButton = middlebotan Then
GraphicsWindow.PenWidth = 4
EndIf
If Controls.LastClickedButton = futoibotan Then
GraphicsWindow.PenWidth = 7
EndIf
If Controls.LastClickedButton = clearbotan Then
GraphicsWindow.BrushColor = "white"
GraphicsWindow.FillRectangle(0, 0, 640, 480)
EndIf
EndSub

GraphicsWindow.keyDown = Onkeydown
Sub Onkeydown
GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor()
EndSub