在WPF中因为在其中添加了图形的效果与滤镜,所以对图形的处理功能很强大。其中BitmapEffect(位图效果)属性能够使图形产生界面效果。每个效果运用很简单。
效果有以下几个:
BevelBitmapEffect:斜角效果
BitmapEffectGroup:复合效果(可以把多个)
BlurBitmapEffect:模糊效果
DropShadowBitmapEffect:投影效果
EmbossBitmapEffect:浮雕效果
OuterGlowBitmapEffect:外发光效果
每个效果都有自己的一系列属性可以调整,比如你可以给投影效果添加高度、角度、阴影深度;
下面是添加投影效果的实例:
<Window x:Class="WpfApplication1.效果"
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"
xmlns:local="clr-namespace:WpfApplication1"
mc:Ignorable="d"
Title="效果"