代码改变世界

wpf倒影效果

2011-07-04 16:11  观海看云  阅读(320)  评论(0编辑  收藏  举报
<Window x:Class="WpfApplication2.Window6"
xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml"
Title
="Window6" Height="800" Width="400" Background="#FF840909">
<Viewbox>

<StackPanel Margin="10">

<Border BorderBrush="White" BorderThickness="8"
Width
="262.999" Height="354.833" Background="#FF130202">

<Image x:Name="myVisual" Stretch="Fill"
Source
="/WpfApplication2;component/images/e31b7dcada9a3077b700c8ea.jpg" />

</Border>

<Border BorderBrush="White" BorderThickness="8" Width="263.621" Height="185.429">

<Border.RenderTransform>

<SkewTransform CenterX="0" CenterY="0" AngleX="-50" AngleY="0"/>

</Border.RenderTransform>

<Border.OpacityMask>

<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">

<GradientStop Offset="0" Color="#FF000000"/>

<GradientStop Offset="0.8" Color="#00000000"/>

</LinearGradientBrush>

</Border.OpacityMask>

<Border.Background>

<VisualBrush Visual="{Binding ElementName=myVisual}">

<VisualBrush.RelativeTransform>

<ScaleTransform ScaleX="1" ScaleY="-1" CenterX="0.5" CenterY="0.5"/>

</VisualBrush.RelativeTransform>

</VisualBrush>

</Border.Background>

</Border>

</StackPanel>

</Viewbox>
</Window>

效果图如下: