我已经试过寻找这个问题的解决方案,但还没有找到任何东西。WPF发光效果没有BitmapEffects
我有一个自定义C++/CLI挂钩的WPF窗口来扩展框架(DWMAPI)并将客户区扩展到框架(Win32/NCCALCSIZE)。我用WPF添加了一个自定义图标和标题。为窗口的标记如下(记住,客户区被调整到玻璃框的边缘):
<Window x:Class="ClrDwmHelper.WpfHost.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ns="clr-namespace:ClrDwmHelper.WpfHost"
Title="My Window Title" Height="350" Width="300"
Background="{x:Null}"
SourceInitialized="Window_SourceInitialized"
Loaded="Window_Loaded">
<Window.Icon>
<DrawingImage>
<DrawingImage.Drawing>
<GeometryDrawing Brush="White">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,0 16,16"/>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingImage.Drawing>
</DrawingImage>
</Window.Icon>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="6"/>
<RowDefinition Height="22"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="6"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="6"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="6"/>
</Grid.ColumnDefinitions>
<Grid Grid.RowSpan="2" Grid.ColumnSpan="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Image Name="SysMenu" Height="16" Width="16" Margin="6,7,6,5" Source="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=Icon}"/>
<Grid Grid.Column="1" Margin="1,6,5,5">
<TextBlock Name="Caption" IsHitTestVisible="False" Foreground="Black" Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=Title}"
FontFamily="{x:Static SystemFonts.CaptionFontFamily}"
FontSize="{x:Static SystemFonts.CaptionFontSize}"
FontStretch="Normal"
FontStyle="{x:Static SystemFonts.CaptionFontStyle}"
TextDecorations="{x:Static SystemFonts.CaptionFontTextDecorations}"
FontWeight="{x:Static SystemFonts.CaptionFontWeight}"
TextTrimming="WordEllipsis">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="0" Color="#FFFFFF" BlurRadius="15"/>
</TextBlock.Effect>
</TextBlock>
</Grid>
</Grid>
<Border Grid.Row="2" Grid.Column="1" BorderBrush="#7FFFFFFF" BorderThickness="1" CornerRadius="1" IsHitTestVisible="False">
<Border Background="White" BorderBrush="#9F000000" BorderThickness="1" CornerRadius="1" IsHitTestVisible="False">
</Border>
</Border>
</Grid>
</Window>
窗口看起来是这样的:
我想要文字周围更加不透明的光晕(NOT文本块)比目前有的(半径为15的DropShadowEffect几乎不可见,但半径为15的WINAPI发光更加不透明)。什么是最好的方法来做到这一点? (自定义效果
包含
首选)