这是上篇WPF中的文字修饰——上划线,中划线,基线与下划线
效果图:
XAML代码:
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Canvas>
<TextBlock FontSize="84" FontFamily="Arial Black" Margin="0,0">
<TextBlock.TextDecorations>
<TextDecoration PenOffset="10" PenOffsetUnit="Pixel" PenThicknessUnit="Pixel">
<TextDecoration.Pen>
<Pen Thickness="5">
<Pen.Brush>
<LinearGradientBrush Opacity="0.5"
StartPoint="0,0.5" EndPoint="1,0.5">
<LinearGradientBrush.GradientStops>
<GradientStop Color="Yellow" Offset="0" />
<GradientStop Color="Red" Offset="1" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Pen.Brush>
</Pen>
</TextDecoration.Pen>
</TextDecoration>
<TextDecoration PenOffset="2" PenOffsetUnit="Pixel" PenThicknessUnit="Pixel">
<TextDecoration.Pen>
<Pen Thickness="1">
<Pen.Brush>
<SolidColorBrush Opacity="0.5" Color="Red"/>
</Pen.Brush>
</Pen>
</TextDecoration.Pen>
</TextDecoration>
</TextBlock.TextDecorations>
GOOD
</TextBlock>
</Canvas>
</Page>
(其实就是使用多个TextDecoration而已!)