代码改变世界

wpf倒影效果

  观海看云  阅读(321)  评论(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>
复制代码

效果图如下:

编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· .NET周刊【3月第1期 2025-03-02】
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
历史上的今天:
2009-07-04 c#在WinForm中重写ProgressBar控件(带%的显示)
点击右上角即可分享
微信分享提示