Silverlight闹钟

一:截图

Silverlight闹钟

二:XAML代码

<UserControl x:Class="SilverlightClock.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Height="" Width=""> <Grid x:Name="LayoutRoot" Loaded="SetAndStartClock">
<!-- 时钟的阴影 -->
<Ellipse Fill="#FF000000" Height="" Margin="42,42,28,28"
Opacity="0.3" Width="" />
<!-- 时钟的外边缘 -->
<Ellipse Height="" Margin="35,35,35,35" Stroke="#FF000000" Width="" >
<Ellipse.Fill>
<LinearGradientBrush EndPoint="0.84,0.87" StartPoint="0.164,0.129">
<GradientStop Color="#FFE4E5F4" />
<GradientStop Color="#FFC0C0C0" Offset="0.254"/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<!-- 时钟的斜边 -->
<Ellipse Height="" Margin="55,55,55,55" Width="" Stroke="#FF000000">
<Ellipse.Fill>
<LinearGradientBrush EndPoint="0.84,0.87" StartPoint="0.164,0.129">
<GradientStop Color="#FF2F2F32"/>
<GradientStop Color="#FFE4E5F4" Offset="0.987"/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<!-- 时钟的表盘 -->
<Ellipse Fill="#FF000000" Height="" Margin="65,65,65,65"
Stroke="#FF000000" Width="" />
<!-- 时钟的中心椭圆 -->
<Ellipse Fill="#FF000000" Height="" Margin="185,185,185,185"
Stroke="#FF008000" StrokeThickness="" VerticalAlignment="Top"
Width="" /> <!-- 秒针 -->
<Rectangle x:Name="secondHand" Fill="#FFFF0000" Height=""
Margin="198,90,197,0" RenderTransformOrigin="0.45,1.34"
Stroke="#FF000000" VerticalAlignment="Top" Width="" >
<Rectangle.RenderTransform>
<RotateTransform x:Name="secondHandTransform"/>
</Rectangle.RenderTransform>
</Rectangle> <!-- 分针 -->
<Rectangle x:Name="minuteHand" Fill="#FF008000" Height=""
Margin="196,90,195,0" RenderTransformOrigin="0.45,1.34"
Stroke="#FF008000" VerticalAlignment="Top" Width="" >
<Rectangle.RenderTransform>
<RotateTransform x:Name="minuteHandTransform"/>
</Rectangle.RenderTransform>
</Rectangle> <!-- 时针 -->
<Rectangle x:Name="hourHand" Fill="#FF008000" Height=""
Margin="195,110,194,0" RenderTransformOrigin="0.45,1.45"
Stroke="#FF008000" VerticalAlignment="Top" Width="" >
<Rectangle.RenderTransform>
<RotateTransform x:Name="hourHandTransform"/>
</Rectangle.RenderTransform>
</Rectangle>
</Grid>
<!--时钟指针动画-->
<UserControl.Resources>
<Storyboard x:Name="clockStoryboard">
<!--时针动作-->
<DoubleAnimation x:Name="hourAnimation"
Storyboard.TargetName="hourHandTransform"
Storyboard.TargetProperty="Angle"
Duration="12:0:0" RepeatBehavior="Forever" To="" /> <!--分针动作-->
<DoubleAnimation x:Name="minuteAnimation"
Storyboard.TargetName="minuteHandTransform"
Storyboard.TargetProperty="Angle"
Duration="1:0:0" RepeatBehavior="Forever" To="" /> <!--秒针动作-->
<DoubleAnimation x:Name="secondAnimation"
Storyboard.TargetName="secondHandTransform"
Storyboard.TargetProperty="Angle"
Duration="0:1:0" RepeatBehavior="Forever" To="" />
</Storyboard>
</UserControl.Resources>
</UserControl>
上一篇:【UVA 11183】 Teen Girl Squad (定根MDST)


下一篇:CF666B. World Tour