<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="myvid.Page" Width="1443" Height="693" Background="#FFE27575" xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Name="userControl"> <UserControl.Resources> <Style x:Key="mybutton" TargetType="Button"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Grid> <vsm:VisualStateManager.VisualStateGroups> <vsm:VisualStateGroup x:Name="FocusStates"> <vsm:VisualState x:Name="Unfocused"/> <vsm:VisualState x:Name="Focused"/> </vsm:VisualStateGroup> <vsm:VisualStateGroup x:Name="CommonStates"> <vsm:VisualStateGroup.Transitions> <vsm:VisualTransition GeneratedDuration="00:00:00.2000000"/> </vsm:VisualStateGroup.Transitions> <vsm:VisualState x:Name="MouseOver"> <Storyboard> <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"> <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF10F9E4"/> </ColorAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Offset)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/> </DoubleAnimationUsingKeyFrames> <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)"> <SplineColorKeyFrame KeyTime="00:00:00" Value="#990EFBFB"/> </ColorAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Offset)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.174"/> </DoubleAnimationUsingKeyFrames> <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle1" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"> <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF121213"/> </ColorAnimationUsingKeyFrames> </Storyboard> </vsm:VisualState> <vsm:VisualState x:Name="Normal"/> <vsm:VisualState x:Name="Pressed"> <Storyboard> <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle1" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"> <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFC1DDEB"/> </ColorAnimationUsingKeyFrames> </Storyboard> </vsm:VisualState> <vsm:VisualState x:Name="Disabled"/> </vsm:VisualStateGroup> </vsm:VisualStateManager.VisualStateGroups> <Rectangle Fill="#FF090A0A" Height="40" Margin="8,15,19,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,-0.643" Stroke="#FF000000" RadiusX="5" RadiusY="5" x:Name="rectangle1"/> <Rectangle Margin="17,21,28,17" Stroke="#FF000000" RadiusX="5" RadiusY="5" x:Name="rectangle"> <Rectangle.Fill> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.491,-0.154"> <GradientStop Color="#FF000000"/> <GradientStop Color="#FFFFFFFF" Offset="1"/> <GradientStop Color="#FF0DCEBD" Offset="0.82999998331069946"/> <GradientStop Color="#FE000404" Offset="0.017999999225139618"/> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> <ContentPresenter RenderTransformOrigin="-0.179,0.812" d:LayoutOverrides="Width" Margin="30,25,39,17"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <Storyboard x:Name="Storyboard1"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.114"/> <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.219"/> <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0.317"/> <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.384"/> <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0.579"/> <SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0.677"/> <SplineDoubleKeyFrame KeyTime="00:00:00.6000000" Value="0.789"/> <SplineDoubleKeyFrame KeyTime="00:00:00.7000000" Value="0.895"/> <SplineDoubleKeyFrame KeyTime="00:00:00.8000000" Value="0.95"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.116"/> <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.221"/> <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0.318"/> <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0.384"/> <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="0.579"/> <SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0.677"/> <SplineDoubleKeyFrame KeyTime="00:00:00.6000000" Value="0.789"/> <SplineDoubleKeyFrame KeyTime="00:00:00.7000000" Value="0.895"/> <SplineDoubleKeyFrame KeyTime="00:00:00.8000000" Value="0.95"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-153"/> <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="-127.165"/> <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="-103.33"/> <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="-87.001"/> <SplineDoubleKeyFrame KeyTime="00:00:00.4000000" Value="-39.002"/> <SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="-15.002"/> <SplineDoubleKeyFrame KeyTime="00:00:00.6000000" Value="12.498"/> <SplineDoubleKeyFrame KeyTime="00:00:00.7000000" Value="38.498"/> <SplineDoubleKeyFrame KeyTime="00:00:00.8000000" Value="51.998"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Duration="00:00:00.0010000"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Duration="00:00:00.0010000"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-21.5"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </UserControl.Resources> <UserControl.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform/> <RotateTransform/> <TranslateTransform/> </TransformGroup> </UserControl.RenderTransform> <Grid x:Name="LayoutRoot" Background="#FF1C1A1A"> <Grid Background="#FF0C0B0B" Margin="423,105,530,175" x:Name="grid" RenderTransformOrigin="0.5,0.5" d:LayoutOverrides="Height"> <Grid.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform/> <RotateTransform/> <TranslateTransform/> </TransformGroup> </Grid.RenderTransform> <MediaElement Margin="0,0,0,53" x:Name="_24286_wmv" Opacity="0.8" Source="24286.wmv" Stretch="Fill" d:LayoutOverrides="Width, Height" AutoPlay="False"/> <Button Height="64" HorizontalAlignment="Left" Style="{StaticResource mybutton}" VerticalAlignment="Bottom" Width="97" Content="开始" Click="onstart" RenderTransformOrigin="0.46,0.609" FontFamily="Arial" FontSize="14" FontWeight="Normal" Foreground="#FFE2F9E4"/> <Button Height="64" HorizontalAlignment="Left" Margin="68,0,0,0" Style="{StaticResource mybutton}" VerticalAlignment="Bottom" Width="97" FontFamily="Arial" FontSize="14" FontWeight="Bold" Foreground="#FFF6D4D3" Content="暂停" Click="onpause"/> <Button Height="64" HorizontalAlignment="Left" Margin="137,0,0,0" Style="{StaticResource mybutton}" VerticalAlignment="Bottom" Width="97" FontSize="14" Foreground="#FFF61B09" Content="结束" Click="onstop"/> <Button Height="3" HorizontalAlignment="Left" Margin="212,0,0,12" VerticalAlignment="Bottom" Width="0" Content="Button"/> <Button FontSize="14" Height="67" HorizontalAlignment="Right" Style="{StaticResource mybutton}" VerticalAlignment="Bottom" Width="102" Content="全屏" Margin="0,0,-13,-3" Background="#FFEEF3F7" Foreground="#FFFDF2F2" Click="fullsrc"> <Button.BorderBrush> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FFA3AEB9"/> <GradientStop Color="#FF8399A9" Offset="0.375"/> <GradientStop Color="#FF718597" Offset="0.375"/> <GradientStop Color="#FFDEE7EE" Offset="1"/> </LinearGradientBrush> </Button.BorderBrush> </Button> <Slider Height="9" VerticalAlignment="Bottom" Margin="234,0,93,26"/> </Grid> <Image Margin="287,243.999,0,0" Source="cd1624df242b5f7295ee3770.jpg" Stretch="Fill" Width="101.446" HorizontalAlignment="Left" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Top" Height="68" Opacity="0.8"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleY="0.23"/> <RotateTransform/> <TranslateTransform Y="-1.504"/> </TransformGroup> </Image.RenderTransform> </Image> <Image Margin="260,157.995,0,0" Source="Winter.jpg" Stretch="Fill" Width="49.678" HorizontalAlignment="Left" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Top" Height="42.966" Opacity="0.6"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleY="-1.746"/> <RotateTransform/> <TranslateTransform Y="-3.97"/> </TransformGroup> </Image.RenderTransform> </Image> <Image Height="74.966" HorizontalAlignment="Left" Margin="149,243.999,0,0" Width="86.678" RenderTransformOrigin="0.5,0.5" Source="Winter.jpg" Stretch="Fill" Opacity="0.85" VerticalAlignment="Top"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleY="-0.721"/> <RotateTransform Angle="0.071"/> <TranslateTransform Y="-2.48" X="-0.003"/> </TransformGroup> </Image.RenderTransform> </Image> <Image HorizontalAlignment="Left" Margin="158,143.002,0,0" Width="62.239" RenderTransformOrigin="0.5,0.5" Source="cd1624df242b5f7295ee3770.jpg" Stretch="Fill" Opacity="0.6" VerticalAlignment="Top" Height="42"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleY="-1.002"/> <RotateTransform/> <TranslateTransform Y="-2.483"/> </TransformGroup> </Image.RenderTransform> </Image> <Image Margin="338,105,0,0" Source="Sunset.jpg" Stretch="Fill" Width="49.667" HorizontalAlignment="Left" VerticalAlignment="Top" Height="37.25" Opacity="0.2" RenderTransformOrigin="1.108,0.345"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleY="0"/> <RotateTransform/> <TranslateTransform Y="0"/> </TransformGroup> </Image.RenderTransform> </Image> <Image HorizontalAlignment="Left" Margin="237,0,0,188.001" Width="128.334" Opacity="1" RenderTransformOrigin="1.108,0.345" Source="Sunset.jpg" Stretch="Fill" VerticalAlignment="Bottom" Height="96.06"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleY="0.129"/> <RotateTransform/> <TranslateTransform Y="-3.33"/> </TransformGroup> </Image.RenderTransform> </Image> <Image Height="68" HorizontalAlignment="Right" Margin="0,243.999,189,0" VerticalAlignment="Top" Width="101.446" Opacity="0.8" RenderTransformOrigin="0.5,0.5" Source="cd1624df242b5f7295ee3770.jpg" Stretch="Fill"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleY="0.23"/> <RotateTransform/> <TranslateTransform Y="-1.504"/> </TransformGroup> </Image.RenderTransform> </Image> <Image Height="42.966" HorizontalAlignment="Right" Margin="0,157.995,329,0" VerticalAlignment="Top" Width="49.678" Opacity="0.6" RenderTransformOrigin="0.5,0.5" Source="Winter.jpg" Stretch="Fill"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleY="-1.746"/> <RotateTransform/> <TranslateTransform Y="-3.97"/> </TransformGroup> </Image.RenderTransform> </Image> <Image Height="74.966" HorizontalAlignment="Left" Margin="149,243.999,0,0" Width="86.678" RenderTransformOrigin="0.5,0.5" Source="Winter.jpg" Stretch="Fill" VerticalAlignment="Top" Opacity="0.85"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleY="-0.721"/> <RotateTransform Angle="0.071"/> <TranslateTransform Y="-2.48" X="-0.003"/> </TransformGroup> </Image.RenderTransform> </Image> <Image HorizontalAlignment="Right" Margin="0,244.002,329,0" Width="62.239" RenderTransformOrigin="0.5,0.5" Source="cd1624df242b5f7295ee3770.jpg" Stretch="Fill" Height="42" VerticalAlignment="Top" Opacity="0.6"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleY="-1.002"/> <RotateTransform/> <TranslateTransform Y="-2.483"/> </TransformGroup> </Image.RenderTransform> </Image> <Image Height="37.25" HorizontalAlignment="Right" Margin="0,128,231,0" VerticalAlignment="Top" Width="49.667" Opacity="0.2" RenderTransformOrigin="1.108,0.345" Source="Sunset.jpg" Stretch="Fill"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleY="0"/> <RotateTransform/> <TranslateTransform Y="0"/> </TransformGroup> </Image.RenderTransform> </Image> <Image HorizontalAlignment="Right" Margin="0,323.996,297,273.004" Width="128.334" Opacity="1" RenderTransformOrigin="1.108,0.345" Source="Sunset.jpg" Stretch="Fill" Height="96.06"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleY="0.129"/> <RotateTransform/> <TranslateTransform Y="-3.33"/> </TransformGroup> </Image.RenderTransform> </Image> <Image Height="74.966" HorizontalAlignment="Right" Margin="0,0,165,175" Width="86.678" RenderTransformOrigin="0.5,0.5" Source="Winter.jpg" Stretch="Fill" Opacity="0.85" VerticalAlignment="Bottom"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleY="-0.721"/> <RotateTransform Angle="0.071"/> <TranslateTransform Y="-2.48" X="-0.003"/> </TransformGroup> </Image.RenderTransform> </Image> <Image HorizontalAlignment="Right" Margin="0,57,387,0" Width="83.765" Opacity="0.8" RenderTransformOrigin="0.5,0.5" Source="cd1624df242b5f7295ee3770.jpg" Stretch="Fill" Height="56.149" VerticalAlignment="Top"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleY="0.23"/> <RotateTransform/> <TranslateTransform Y="-1.504"/> </TransformGroup> </Image.RenderTransform> </Image> <Image Height="74.966" HorizontalAlignment="Left" Margin="92,0,0,229.002" Width="86.678" RenderTransformOrigin="0.5,0.5" Source="Winter.jpg" Stretch="Fill" Opacity="0.85" VerticalAlignment="Bottom"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform AngleY="-0.721"/> <RotateTransform Angle="0.071"/> <TranslateTransform Y="-2.48" X="-0.003"/> </TransformGroup> </Image.RenderTransform> </Image> </Grid> </UserControl>
1. using System; 2. using System.Windows; 3. using System.Windows.Controls; 4. using System.Windows.Documents; 5. using System.Windows.Ink; 6. using System.Windows.Input; 7. using System.Windows.Media; 8. using System.Windows.Media.Animation; 9. using System.Windows.Shapes; 10. using System.Windows.Interop; 11. namespace myvid 12. { 13. public partial class Page : UserControl 14. { 15. public Page() 16. { 17. // 需要初始化变量 18. InitializeComponent(); 19. Storyboard1.Begin(); 20. } 21. 22. private void onstart(object sender, RoutedEventArgs e) 23. { 24. 25. _24286_wmv.Play(); 26. 27. } 28. 29. private void onpause(object sender, RoutedEventArgs e) 30. { 31. 32. _24286_wmv.Pause(); 33. 34. 35. } 36. 37. private void onstop(object sender, RoutedEventArgs e) 38. { 39. _24286_wmv.Stop(); 40. } 41. 42. private void fullsrc(object sender, RoutedEventArgs e) 43. { 44. Content contendobject = Application.Current.Host.Content; 45. contendobject.IsFullScreen = !contendobject.IsFullScreen; 46. } 47. } 48. }