为什么 WPF 中的一切都是模糊的? [英] Why everything in WPF is blurry?

查看:31
本文介绍了为什么 WPF 中的一切都是模糊的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释为什么 WPF 中的所有内容都很模糊吗?这是可以修复的吗?

Can someone explain why everything in WPF is blurry? Is this something that can be fixed?

推荐答案

这是因为抗锯齿系统会在线条与物理设备像素不对齐时将线条扩展到多个像素上.

The reason for this is the anti-aliasing system which spreads the line over multiple pixels if it doesn't align with physical device pixels.

WPF 与分辨率无关.这意味着您以英寸为单位指定用户界面元素的大小,而不是以像素为单位.WPF 中的逻辑单位是 1/96 英寸.选择此比例是因为大多数屏幕的分辨率为 96dpi.所以在大多数情况下,1 个逻辑单元匹配 1 个物理像素.但如果屏幕分辨率发生变化,则此规则不再有效.

WPF is resoultion independent. This means you specify the size of an user interface element in inches, not in pixels. A logical unit in WPF is 1/96 of an inch. This scale is chosen, because most screens have a resolution of 96dpi. So in most cases 1 logical unit matches to 1 physical pixel. But if the screen resolution changes, this rule is no longer valid.

所有 WPF 控件都提供一个属性 SnapsToDevicePixels.如果设置为 true,则控件确保所有边缘都精确地绘制在物理设备像素上.但不幸的是,此功能仅在控制级别可用.

All WPF controls provide a property SnapsToDevicePixels. If set to true, the control ensures the all edges are drawn excactly on physical device pixels. But unfortunately this feature is only available on control level.

来源:在物理设备像素上精确绘制线条

这篇关于为什么 WPF 中的一切都是模糊的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆