WPF TextBlock effect DropShadrowEffect,BlurEffect

<Window x:Class="WpfApp32.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp32"
        WindowState="Maximized"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <TextBlock Text="DropShadow Effect" FontSize="100" Foreground="Blue"
                   Grid.Row="0" Grid.Column="0">
            <TextBlock.Effect>
                <DropShadowEffect 
                   Color="Red"
                   Direction="10"
                   ShadowDepth="0"
                   BlurRadius="10"
                   Opacity="0.5"
                   RenderingBias="Quality"/>
            </TextBlock.Effect>
        </TextBlock>
        
        <TextBlock Text="DropShadow Effect" FontSize="100" Foreground="Blue"
           Grid.Row="1">
            <TextBlock.Effect>
                <DropShadowEffect Color="Black"
                    Direction="0"
                    ShadowDepth="15"
                    BlurRadius="50"
                    Opacity="0.8"
                    RenderingBias="Performance"/>
            </TextBlock.Effect>
        </TextBlock>

        <TextBlock Text="Blurred Effect"  FontSize="100" Grid.Row="2" Foreground="Black">
            <TextBlock.Effect>
                <BlurEffect Radius="10" KernelType="Gaussian"/>
            </TextBlock.Effect>
        </TextBlock>

        <TextBlock Text="Blurred Effect"  FontSize="100" Grid.Row="3" Foreground="Black">
            <TextBlock.Effect>
                <BlurEffect Radius="10" KernelType="Box"/>
            </TextBlock.Effect>
        </TextBlock>

        <TextBlock Text="Glowing Text" FontSize="100" Grid.Row="4" Foreground="Black">
            <TextBlock.Effect>
                <DropShadowEffect 
                       Color="Cyan"
                       Direction="0"
                       ShadowDepth="0"
                       BlurRadius="15"
                       Opacity="0.8"/>
            </TextBlock.Effect>
        </TextBlock>
    </Grid>
</Window>

 

 

image

 

posted @ 2025-09-22 15:59  FredGrit  阅读(3)  评论(0)    收藏  举报