Microsoft Small Basic
Program Listing:
Embed this in your website
<object id='sbapp' data='data:application/x-silverlight-2,' type='application/x-silverlight-2' width='640' height='480'> <param name='source' value='http://smallbasic.com/program/ClientBin/SBWeb.xap'/> <param name='onError' value='onSilverlightError' /> <param name='background' value='white' /> <param name='minRuntimeVersion' value='3.0.40624.0' /> <param name='autoUpgrade' value='true' /> <param name='initParams' value='programId=JRB927' /> </object>
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
Copyright (c) Microsoft Corporation. All rights reserved.