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=SWQ275' /> </object>
' Heart 0.1
' Copyright (c) 2013 Nonki Takahashi. All rights reserved.
'
' History:
' 2013/02/02 Created.
'
GraphicsWindow
.
Title
=
"Heart 0.1 - Happy Valentine's Day."
x
=
180
y
=
60
r
=
80
GraphicsWindow
.
BrushColor
=
"Crimson"
GraphicsWindow
.
FillEllipse
(
x
,
y
,
2
*
r
,
2
*
r
)
GraphicsWindow
.
FillEllipse
(
x
+
Math
.
SquareRoot
(
2
)
*
r
,
y
,
2
*
r
,
2
*
r
)
x1
=
x
+
r
-
r
/
Math
.
SquareRoot
(
2
)
y1
=
y
+
r
+
r
/
Math
.
SquareRoot
(
2
)
x2
=
x1
+
2
*
Math
.
SquareRoot
(
2
)
*
r
y2
=
y1
x3
=
x1
+
Math
.
SquareRoot
(
2
)
*
r
y3
=
y1
+
Math
.
SquareRoot
(
2
)
*
r
GraphicsWindow
.
FillTriangle
(
x1
,
y1
,
x2
,
y2
,
x3
,
y3
)
GraphicsWindow
.
PenColor
=
"White"
x0
=
x
+
r
y0
=
y
+
r
GraphicsWindow
.
DrawLine
(
x1
,
y1
,
x0
,
y0
)
fh
=
20
GraphicsWindow
.
FontSize
=
fh
GraphicsWindow
.
FontName
=
"Times New Roman"
GraphicsWindow
.
BrushColor
=
"White"
GraphicsWindow
.
DrawText
(
(
x0
+
x1
)
/
2
,
(
y0
+
y1
)
/
2
,
"r"
)
GraphicsWindow
.
BrushColor
=
"Black"
GraphicsWindow
.
DrawText
(
x
,
y3
+
r
/
3
,
"S = π * r ^ 2 + (2 * r) ^ 2"
)
S
=
Math
.
Pi
*
1
*
1
+
(
2
*
1
)
*
(
2
*
1
)
GraphicsWindow
.
DrawText
(
x
,
y3
+
r
/
3
+
fh
,
" = "
+
S
)
GraphicsWindow
.
DrawText
(
x
,
y3
+
r
/
3
+
fh
*
2
,
"while r = 1"
)
Copyright (c) Microsoft Corporation. All rights reserved.