wpf 阴影效果

一般的方式是重写窗体样式,在图片容器外套一层容器,对它应用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,有个问题是阴影会环绕每个图标,而不是环绕整个窗体

posted @ 2015-03-22 23:21  长白山  阅读(507)  评论(0编辑  收藏  举报