WPF中文本的外斜面效果

ser*_*hio 8 .net wpf wpf-controls

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

替代文字

至于我,辉光效应应该足够了:

替代文字

Fre*_*lad 6

这是一种在Text上获得Glow效果的方法.使用提供Stroke的此链接中的OutlinedText控件.

替代文字

<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>
Run Code Online (Sandbox Code Playgroud)

更新
这是我最接近斜角效果但它不能很好地工作.使用此链接的方法.

替代文字

<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"/>
Run Code Online (Sandbox Code Playgroud)


Mac*_*ius 0

据我所知,这可行:

<Label Content="Hi there!">
<Label.BitmapEffect>
<OuterGlowBitmapEffect/>
</Label.BitmapEffect>
</Label>
Run Code Online (Sandbox Code Playgroud)

我还没有在标签中测试过这一点,但我已经在其他控件和形状中为我工作过,另外,请查看 IntelliSense 为您提供的所有效果列表:)

  • BitmapEffect 已被弃用,这就是为什么它在 wpf 4 中不显示任何内容。您最好的选择是自定义 PixelShader。 (2认同)