将笔触应用于XAML中的文本块 [英] Apply stroke to textblock in XAML
本文介绍了将笔触应用于XAML中的文本块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 Silverlight
应用程序,我想在其中给我的 textblock
一个大纲(不是文本块,字符本身),也称为 stroke
.
I have a Silverlight
app where I want to give my textblock
an outline (not the textblock, the characters themselves), otherwise known as stroke
.
我找到了此问题,该问题适用于 WPF
,但是在使用 XAML/Silverlight
( PresentationFramework
不是 Silverlight
程序集)时,有没有办法做到这一点?是否有现有的实现?
I found this question which works for WPF
, but is there a way to accomplish this when working with XAML/Silverlight
(PresentationFramework
is not a Silverlight
assembly)? Is there an existing implementation?
推荐答案
使用@Chris W.的想法,我想出了这段代码,尽管它不是最好的解决方案,但它可以工作:
Going with @Chris W. idea, I came up with this code, although not the finest solution, it works:
<StackPanel>
<!-- With DropShadow -->
<TextBlock Foreground="#FFFF0000" Text="With DropShadow" FontSize="16">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="0" BlurRadius="1" Color="#FF000000" />
</TextBlock.Effect>
</TextBlock>
<!-- No DropShadow -->
<TextBlock Foreground="#FFFF0000" Text="No DropShadow" FontSize="16" />
</StackPanel>
这篇关于将笔触应用于XAML中的文本块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文