3 <style type=
"text/css">
19 <script type=
"text/javascript">
21 function CreateRectangle(l
, t
, i
, sj
, master
)
24 '<Rectangle xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" \
25 x:Name="rect%no%" Canvas.Left="%left%" Canvas.Top="%top%" Width="5" Height="5" Fill="Black"> \
26 <Rectangle.Resources> \
27 <Storyboard x:Name="sb%no%"> \
29 Storyboard.TargetName="rect%no%" \
30 Storyboard.TargetProperty="(Canvas.Left)" \
31 To="195" Duration="0:0:4" /> \
33 Storyboard.TargetName="rect%no%" \
34 Storyboard.TargetProperty="(Canvas.Top)" \
35 To="195" Duration="0:0:4" /> \
37 </Rectangle.Resources> \
40 xaml
= xaml
.replace(/%no%/g, i
);
41 xaml
= xaml
.replace(/%top%/g, t
);
42 xaml
= xaml
.replace(/%left%/g, l
);
44 var obj
= sj
.createFromXaml(xaml
);
45 master
.Children
.Add(obj
);
46 master
.findName ("sb%no%".replace('%no%', i
)).Begin ();
49 function OnLoaded (sender
)
51 var SJ
= document
.getElementById ("slControl").content
;
52 var master
= sender
.findName("MasterCanvas");
54 for (i
= 0; i
< 40; i
++)
55 xaml
= CreateRectangle (0, i
* 10, i
, SJ
, master
);
57 for (i
= 40; i
< 80; i
++)
58 xaml
= CreateRectangle (390, (i
- 40) * 10, i
, SJ
, master
);
60 for (i
= 80; i
< 120; i
++)
61 xaml
= CreateRectangle ((i
- 80) * 10, 0, i
, SJ
, master
);
63 for (i
= 120; i
< 160; i
++)
64 xaml
= CreateRectangle ((i
- 120) * 10, 390, i
, SJ
, master
);
68 <embed type=
"application/x-silverlight" data=
"data:," id=
"slControl" width=
"400" height=
"400" source=
"#xamlContent" windowless=
"true">
70 <script type=
"text/xaml" id=
"xamlContent">
72 <Canvas xmlns=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
73 xmlns:
x=
"http://schemas.microsoft.com/winfx/2006/xaml" x:
Name=
"MasterCanvas" Loaded=
"OnLoaded">