回归上次,
把XAML源码复制黏贴到···SilverlightmusicHit项目上的···MainPage上,就会把那一闪一闪的···放进去了
(有没有发现有啥不同额,··没错··是倒影~~)
1、再写一个新的button···使用一样的样式,StaticResource buttonStyle1,
<button GrID.Column="1" margin="-137,121" RendertransformOrigin="0.5,0.5" Style="{StaticResource buttonStyle1}" Height="72" VerticalAlignment="Bottom" HorizontalAlignment="left" WIDth="278" Content="Hill@Home" Opacity="0.1"> <button.Rendertransform> <transformGroup> <Scaletransform ScaleY="-1"/> <Translatetransform Y="10"></Translatetransform> </transformGroup>
具体用法··查看MSDN
Rendertransform 属性
获取或设置影响此元素呈现位置的转换信息。 这是一个依赖项属性。
MainPage源码
<UserControl x:Class="SilverlightmusicHit.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" d:DesignHeight="600" d:DesignWIDth="800"> <UserControl.Resources> <Style x:Key="buttonStyle1" targettype="button"> <Setter Property="Template"> <Setter.Value> <ControlTemplate targettype="button"> <GrID> <visualstatemanager.VisualStateGroups> <VisualStateGroup x:name="CommonStates"> <VisualState x:name="normal"> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.Targetname="contentPresenter"> <EasingDoubleKeyFrame KeyTime="0" Value="1"/> <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0.75"/> <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.5"/> <EasingDoubleKeyFrame KeyTime="0:0:1.5" Value="0.25"/> <EasingDoubleKeyFrame KeyTime="0:0:2" Value="0"/> <EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="0.25"/> <EasingDoubleKeyFrame KeyTime="0:0:3" Value="0.5"/> <EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="0.75"/> <EasingDoubleKeyFrame KeyTime="0:0:4" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:name="MouSEOver"/> <VisualState x:name="pressed"/> <VisualState x:name="Disabled"/> </VisualStateGroup> </visualstatemanager.VisualStateGroups> <ContentPresenter x:name="contentPresenter" OpacityMask="Black"/> </GrID> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="FontFamily" Value="Arial Black"/> <Setter Property="FontSize" Value="48"/> <Setter Property="Foreground"> <Setter.Value> <linearGradIEntBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradIEntStop color="Black" Offset="0"/> <GradIEntStop color="White" Offset="1"/> <GradIEntStop color="#FF1D1D1D" Offset="0.116"/> <GradIEntStop color="#FF303030" Offset="0.191"/> </linearGradIEntBrush> </Setter.Value> </Setter> </Style> </UserControl.Resources> <GrID x:name="LayoutRoot"> <GrID.ColumnDeFinitions> <ColumnDeFinition WIDth="300"/> <ColumnDeFinition WIDth="auto" /> <ColumnDeFinition WIDth="35*" /> </GrID.ColumnDeFinitions> <GrID.Background> <linearGradIEntBrush EndPoint="0.803,1.006" StartPoint="0.8,-0.006"> <GradIEntStop color="Black" Offset="0.584"/> <GradIEntStop color="White" Offset="1"/> </linearGradIEntBrush> </GrID.Background> <button Content="Hill@Home" GrID.Column="1" margin="-137,153" RendertransformOrigin="0.5,0.5" Style="{StaticResource buttonStyle1}" Height="72" VerticalAlignment="Bottom" HorizontalAlignment="left" WIDth="278"/> <button GrID.Column="1" margin="-137,0.5" Style="{StaticResource buttonStyle1}" Height="72" VerticalAlignment="Bottom" HorizontalAlignment="left" WIDth="278" Content="Hill@Home" Opacity="0.1"> <button.Rendertransform> <transformGroup> <Scaletransform ScaleY="-1"/> <Translatetransform Y="10"></Translatetransform> </transformGroup> </button.Rendertransform> </button> <button name="btnStart" Content="Play Game" GrID.Column="1" Height="69" HorizontalAlignment="left" margin="209,378,0" VerticalAlignment="top" WIDth="256" FontFamily="Comic Sans MS" FontSize="26" Background="#FFE2C200" Foreground="#FF570000" Click="btnStart_Click" Opacity="0.5"></button> <Canvas name="Hit" margin="267,226,64,239" WIDth="135" Height="135" GrID.Column="1"></Canvas> <TextBlock name="txtBlog" Text="http://blog.csdn.net/cheng110110" Height="20" VerticalAlignment="Bottom" HorizontalAlignment="left" WIDth="300" /> </GrID></UserControl>
再改改它的 透明度Opacity="0.1" 倒影就这样完成了~~
name:5+x
参考文章与书籍:
MSDN
Expression Blend知识锦
WPF葵花宝典
总结以上是内存溢出为你收集整理的silverlight乐动魔方 实战二全部内容,希望文章能够帮你解决silverlight乐动魔方 实战二所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)