你的位置:首页 > ASP.net教程

[ASP.net教程]模仿36。杀毒~button


 1 <Style x:Key="360btn" TargetType="{x:Type Button}"> 2       <Setter Property="Template"> 3         <Setter.Value> 4           <ControlTemplate TargetType="{x:Type Button}"> 5             <ControlTemplate.Resources> 6               <Storyboard x:Key="Storyboard1"> 7                 <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="border"> 8                   <EasingColorKeyFrame KeyTime="0" Value="White"/> 9                 </ColorAnimationUsingKeyFrames>10                 <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="border">11                   <EasingColorKeyFrame KeyTime="0" Value="White"/>12                   <EasingColorKeyFrame KeyTime="0:0:0.1" Value="#FFA2E5A0"/>13                 </ColorAnimationUsingKeyFrames>14                 <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="p2">15                   <EasingColorKeyFrame KeyTime="0:0:0.1" Value="White"/>16                   <EasingColorKeyFrame KeyTime="0:0:0.3" Value="#FF41C236"/>17                 </ColorAnimationUsingKeyFrames>18                 <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="p3">19                   <EasingColorKeyFrame KeyTime="0:0:0.2" Value="White"/>20                   <EasingColorKeyFrame KeyTime="0:0:0.4" Value="#FF41C236"/>21                 </ColorAnimationUsingKeyFrames>22                 <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="p4">23                   <EasingColorKeyFrame KeyTime="0:0:0.3" Value="White"/>24                   <EasingColorKeyFrame KeyTime="0:0:0.5" Value="#FF41C236"/>25                 </ColorAnimationUsingKeyFrames>26                 <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="p5">27                   <EasingColorKeyFrame KeyTime="0:0:0.4" Value="White"/>28                   <EasingColorKeyFrame KeyTime="0:0:0.6" Value="#FF41C236"/>29                 </ColorAnimationUsingKeyFrames>30                 <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="p1">31                   <EasingColorKeyFrame KeyTime="0" Value="White"/>32                   <EasingColorKeyFrame KeyTime="0:0:0.1" Value="#FF41C236"/>33                 </ColorAnimationUsingKeyFrames>34               </Storyboard>35             </ControlTemplate.Resources>36             37             <Border x:Name="border" CornerRadius="70" BorderBrush="white" BorderThickness="6" Height="142" Width="143" Background="Black">38             <Grid>39               <Rectangle x:Name="rectangle" Fill="White" HorizontalAlignment="Left" Height="130" RadiusY="65" RadiusX="65" Stroke="#41C236" StrokeThickness="3" VerticalAlignment="Top" Width="131"/>40               <Rectangle Fill="White" HorizontalAlignment="Left" Height="50" Margin="36" RadiusY="65" RadiusX="65" Stroke="#41C236" StrokeThickness="3" VerticalAlignment="Top" Width="50"/>41               <Rectangle Fill="#41C236" HorizontalAlignment="Left" Height="9.448" Margin="80 80 0 0" Stroke="#41C236" StrokeThickness="3" VerticalAlignment="Top" Width="23.729" RenderTransformOrigin="0.5,0.5" RadiusY="3.654" RadiusX="3.654">42                 <Rectangle.RenderTransform>43                 <TransformGroup>44                   <RotateTransform Angle="32.454"/>45                 </TransformGroup>46               </Rectangle.RenderTransform>47             </Rectangle>48             <Path x:Name="p1" Data="M150,120 L173,120" Fill="White" HorizontalAlignment="Left" Height="3" Margin="40 66 0 0" Stretch="Fill" Stroke="#41C236" StrokeThickness="3" VerticalAlignment="Top" Width="17"/>49             <Path x:Name="p2" Data="M171,124 L181,111" Fill="White" HorizontalAlignment="Left" Height="20.314" Margin="50 48 0 0" Stretch="Fill" Stroke="#41C236" StrokeThickness="3" VerticalAlignment="Top" Width="17.23" RenderTransformOrigin="0.5,0.5">50       <Path.RenderTransform>51         <TransformGroup>52           <ScaleTransform/>53           <SkewTransform/>54           <RotateTransform Angle="-19.995"/>55           <TranslateTransform/>56         </TransformGroup>57       </Path.RenderTransform>58     </Path>59     <Path x:Name="p3" Data="M177,107 L179.5,119.5" Fill="White" HorizontalAlignment="Left" Height="33.5" Margin="61 43 0 0" Stretch="Fill" Stroke="#41C236" StrokeThickness="3" VerticalAlignment="Top" Width="10"/>60             <Path x:Name="p4" Data="M185,138 L192.5,124" Fill="White" HorizontalAlignment="Left" Height="17" Margin="69 58 0 0" Stretch="Fill" Stroke="#41C236" StrokeThickness="3" VerticalAlignment="Top" Width="10.5"/>61             <Path x:Name="p5" Data="M190,124 L200,124" Fill="White" HorizontalAlignment="Left" Height="3" Margin="74 60 0 0" Stretch="Fill" Stroke="#41C236" StrokeThickness="3" VerticalAlignment="Top" Width="13"/>62             63             </Grid>64             </Border>65             <ControlTemplate.Triggers>66               <Trigger Property="IsMouseOver" Value="True">67                 <Trigger.EnterActions>68                   <BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>69                 </Trigger.EnterActions>70                 71               </Trigger>72             </ControlTemplate.Triggers>73           </ControlTemplate>74         </Setter.Value>75      </Setter>      76     </Style>

style
1 <Button x:Name="button" Style="{DynamicResource 360btn}" Margin="394,230,75,69">2       3     </Button>

View Code

附上效果图: