在WPF文本外斜角效果 [英] Outer bevel effect on text in WPF
本文介绍了在WPF文本外斜角效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能申请外斜角效果在WPF标签文本?
Is it possible to apply an outer bevel effect to the label text in WPF?
对于我来说,光晕效果应该是足够了:
as for me, the Glow effect should be sufficient:
推荐答案
下面是一种方式来获得的文本光晕效果。使用OutlinedText控制从此链接它提供了中风。
Here's a way to get Glow-effect on Text. Using the OutlinedText control from this link which offers Stroke.
<local:OutlinedText FontSize="100"
Fill="Black"
Bold="True"
Stroke="White"
StrokeThickness="3"
Text="Glow">
<local:OutlinedText.Effect>
<DropShadowEffect ShadowDepth="0"
Color="White"
Opacity="1"
BlurRadius="12"/>
</local:OutlinedText.Effect>
</local:OutlinedText>
更新
这是我来斜角效果最接近的,但它并不能很好地工作。从使用的方法<一href="http://blogs.infragistics.com/blogs/ux/archive/2010/09/01/text-bevel-effect-in-silverlight-and-wpf.aspx"相对=nofollow>这个链接。
Update
This is the closest I've come to a Bevel effect but it doesn't work very well. Used the approach from this link.
<Style x:Key="ContentControlStyle1" TargetType="{x:Type ContentControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ContentControl}">
<Grid>
<TextBlock Name="Highlight" Foreground="#66FFFFFF" Text="{TemplateBinding Content}" />
<TextBlock Name="Shadow" Margin="0,4,0,0" Foreground="#CC000000" Text="{TemplateBinding Content}"/>
<ContentPresenter Margin="0,2,0,0"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ContentControl Style="{DynamicResource ContentControlStyle1}" FontSize="101" Foreground="DarkGray" Content="Bevel"/>
这篇关于在WPF文本外斜角效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文