wpf 阴影效果

时间:2015-03-23 00:02:50   收藏:0   阅读:843

一般的方式是重写窗体样式,在图片容器外套一层容器,对它应用DropShadowEffect:

<Window x:Class="WpfWindowDropShadowEffect.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="70" Width="320" 
        WindowStyle="None" AllowsTransparency="True" Background="Transparent"
        WindowStartupLocation="Manual">
    <Border Margin="10">
        <Border.Effect>
            <DropShadowEffect BlurRadius="15" Direction="-90" RenderingBias="Quality" ShadowDepth="2"/>
        </Border.Effect>
        <StackPanel Orientation="Horizontal" >
            <Image Source="Images\1.ico" Height="50" Width="50" />
            <Image Source="Images\2.ico" Height="50" Width="50" />
            <Image Source="Images\3.ico" Height="50" Width="50" />
            <Image Source="Images\4.ico" Height="50" Width="50" />
            <Image Source="Images\5.ico" Height="50" Width="50" />
            <Image Source="Images\6.ico" Height="50" Width="50" />
        </StackPanel>
    </Border>
</Window>

技术分享

我的ICO都是Metro样式的,如截图看来基本没问题,对于像你这种ICO,有个问题是阴影会环绕每个图标,而不是环绕整个窗体

原文:http://www.cnblogs.com/changbaishan/p/4358391.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!