C# Windows Phone文本大纲
是否可以在windows phone 8中勾勒文本,例如,我有红色文本,但我希望轮廓为黑色 我应该在C#的xaml中执行此操作吗?如果可能,还应该如何执行?任何例子都将不胜感激C# Windows Phone文本大纲,c#,xaml,windows-phone-8,styling,C#,Xaml,Windows Phone 8,Styling,是否可以在windows phone 8中勾勒文本,例如,我有红色文本,但我希望轮廓为黑色 我应该在C#的xaml中执行此操作吗?如果可能,还应该如何执行?任何例子都将不胜感激 thanx在这里您可以看到它是如何完成的: 它不再工作了。由于性能问题,Microsoft已将其删除 应用程序因使用这些效果而受到的性能影响对系统造成了太大的压力,因此决定,如果我们不能提供performant功能,我们将禁用它,直到我们能够做到的时候 唯一的可能是创建2个文本块并更改FontSize、RenderTra
thanx在这里您可以看到它是如何完成的: 它不再工作了。由于性能问题,Microsoft已将其删除 应用程序因使用这些效果而受到的性能影响对系统造成了太大的压力,因此决定,如果我们不能提供performant功能,我们将禁用它,直到我们能够做到的时候 唯一的可能是创建2个文本块并更改FontSize、RenderTransfer、FontWeight等
<TextBlock Text="{Binding ElementName=BackgroundText,Path=Text}" FontSize="25" Foreground="Red" FontWeight="ExtraBold">
</TextBlock>
<TextBlock Text="Hello" Name="BackgroundText" FontSize="25" Foreground="White" FontWeight="Bold">
<TextBlock.RenderTransform>
<TranslateTransform X="0.5" Y="0" />
</TextBlock.RenderTransform>
</TextBlock>
</TextBlock>
由于两个具有不同FontWieghts的文本块无法帮助您处理大文本(仅比简单的“Hello”长),因为粗体文本将先于细体文本,因此我建议您使用4个文本块,按左上角、右上角等移动1,并将不透明度设置为0.5以平滑轮廓。 这里有一个例子:
<TextBlock Grid.Row="0" Text="Outlined text" Style="{StaticResource OutlineTb}">
<TextBlock.RenderTransform>
<TranslateTransform X="-1" Y="1" />
</TextBlock.RenderTransform>
</TextBlock>
<TextBlock Grid.Row="0" Text="Outlined text" Style="{StaticResource OutlineTb}">
<TextBlock.RenderTransform>
<TranslateTransform X="-1" Y="-1" />
</TextBlock.RenderTransform>
</TextBlock>
<TextBlock Grid.Row="0" Text="Outlined text" Style="{StaticResource OutlineTb}">
<TextBlock.RenderTransform>
<TranslateTransform X="1" Y="-1" />
</TextBlock.RenderTransform>
</TextBlock>
<TextBlock Grid.Row="0" Text="Outlined text" Style="{StaticResource OutlineTb}">
<TextBlock.RenderTransform>
<TranslateTransform X="1" Y="1" />
</TextBlock.RenderTransform>
</TextBlock>
<TextBlock Grid.Row="0"
Text="Outlined text"
FontSize="25"
Foreground="White"
FontWeight="Normal">
</TextBlock>
风格:
<Style TargetType="TextBlock" x:Key="OutlineTb">
<Setter Property="FontSize" Value="25" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Opacity" Value="0.5" />
</Style>
但请记住,这是一个相当“沉重”的解决方案,仍然不如真正的大纲好