.net - WPF中文本的外斜角效果

标签 .net wpf wpf-controls

是否可以对 WPF 中的标签文本应用外斜角效果?

alt text

对于我来说,Glow 效果应该足够了:

alt text

最佳答案

这是一种在文本上获得发光效果的方法。使用来自 this link 的 OutlinedText 控件提供中风。

alt text

<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>

更新
这是我最接近斜角效果的方法,但效果不佳。使用了来自 this link 的方法.

alt text
<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"/>

关于.net - WPF中文本的外斜角效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4334704/

相关文章:

c# - .cs 文件在我修改后加载时会被编译吗?

c# - 以编程方式删除数据 GridView 中的行标题

具有相同宽度字符的 C# .NET 多行文本框

c# - 如何将菜单与 WPF MVVM 合并?

wpf - 如何在不切断选项卡的情况下向 WPF TabItems 添加水平边距?

c# - 供手动用户使用的免费 G​​UI 测试器

wpf - 如何在字符串索引器数据绑定(bind)上实现 IDataErrorInfo?

c# - WPF 将标签内容绑定(bind)到变量

c# - WinFORMS 中的 WPF 用户控件 : Project Structuring

wpf-controls - WPF TextBox 使用鼠标悬停多次重新绘制