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