wpf 加阴影效果导致内容模糊的问题解决
2024-10-15 03:24:06
这个和GPU有关,参考地址
https://www.cplotts.com/2009/02/25/gpu-effects-blurry-text/
产生问题的代码如下:
<Window
x:Class="EffectsAndBlurryText.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Effects and Blurry Text (Bad)"
Height="300"
Width="500"
>
<Grid>
<Border
Margin="20"
Background="White"
BorderBrush="DarkBlue"
BorderThickness="3"
CornerRadius="25"
>
<Border.Effect>
<DropShadowEffect Color="DarkGray"/>
</Border.Effect>
<TextBlock
Text="Why, oh, why is this text blurry?"
FontSize="24"
TextWrapping="Wrap"
Foreground="DarkBlue"
HorizontalAlignment="Center"
VerticalAlignment="Center"
/>
</Border>
</Grid>
</Window>
解决问题的代码如下:
<Window
x:Class="EffectsAndBlurryText.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Effects and Blurry Text (Fixed)"
Height="300"
Width="500"
>
<Grid>
<Border
Margin="20"
BorderThickness="3"
CornerRadius="25"
Background="White"
BorderBrush="DarkBlue"
>
<Border.Effect>
<DropShadowEffect Color="DarkGray"/>
</Border.Effect>
</Border>
<Border
Margin="20"
BorderThickness="3"
CornerRadius="25"
>
<TextBlock
Text="Ah, now, the text is not blurry."
FontSize="24"
TextWrapping="Wrap"
Foreground="DarkBlue"
HorizontalAlignment="Center"
VerticalAlignment="Center"
/>
</Border>
</Grid>
</Window>
最新文章
- PLSQLDeveloper 常用设置
- mysql and 和 or 的 优先级和 查询问题
- linux基础命令学习五(软件包管理、下载管理)
- com学习(四)2——用 ATL 写第一个组件(vs2003)
- 【转】用java实例学习MVC模式
- 如何保护 .NET 应用的安全?
- 经典阅读-《Effective C++》Item1:视C++为一个联邦语言
- Gradle学习之基础篇
- blfs(systemv版本)学习笔记-编译安装i3-wm平铺式窗口管理器
- Python-获取法定节假日
- 25个最常用的iptables策略
- Python 爬虫-Robots协议
- 序列化和反序列化(json 和pickle)dumps 为序列化, json为反序列化
- 解压查看二进制rpm包的方法
- 如何递归执行view的动画
- Python 3.6安装教程
- 设计模式--观察者模式C++实现
- 安装Hadoop2.7和hive2.0以及redis
- HDU 1176 免费馅饼 简单动态规划
- iOS 闭包传值 和 代理传值