wpf密码文本框默认文本_WPF和文本模糊,现在完全清晰

wpf密码文本框默认文本

wpf密码文本框默认文本

The #1 complaint I hear about WPF (Windows Presentation Foundation) is that many fonts end up looking "blurry." It's a darned shame because really great applications like Evernote get criticized because of this one issue*.

我听到的有关WPF(Windows Presentation Foundation)的#1抱怨是许多字体最终看起来都是“模糊”的。 这真是令人羞愧,因为像Evernote这样的出色应用程序因为这一问题而受到批评*。

The blurriness happens on .NET 3.5 and below because WPF's graphics system is "device independent" so rendering happens independent of resolution. It makes apps DPI-aware for free and scales them nicely. Unfortunately MOST people are running on 96dpi screens and that's where you'd expect clarity. You can get around this 90% of the time today using SnapsToDevicePixels when appropriate, but it wasn't automatic and it's subtle.

由于WPF的图形系统“与设备无关”,因此渲染发生与分辨率无关,因此在.NET 3.5及更低版本上会发生模糊。 它使应用程序可以免费识别DPI,并可以很好地扩展它们。 不幸的是,大多数人都在96dpi屏幕上运行,而这正是您期望得到的清晰度。 您现在可以在适当的时候使用SnapsToDevicePixels来解决90%的问题,但这并不是自动的,而且很微妙。

The good news is that with .NET 4 this is totally fixed. You can see with with the .NET 4 RC (Release Candidate) and VS2010, which uses WPF for much of its own rendering. Additionally, a check-in in a recent milestone makes things even clearer with light text on a dark background.

好消息是,使用.NET 4时,此问题已完全修复。 您可以在.NET 4 RC(发布候选版本)和VS2010中看到它们,后者使用WPF进行自己的大部分渲染。 此外,最近里程碑中的签入操作使深色背景上的浅色文字更加清晰明了。

From the WPF Text Blog:

从WPF文本博客中:

"With this fixed, WPF is not technically pixel perfect with GDI text rendering, but the difference is indiscernible to the naked eye."

“使用此修复程序后,WPF在技术上并不是GDI文本渲染的完美像素,但是肉眼看不到差异。”

So how indiscernible?

那么如何辨别呢?

UPDATE: A little confusion about this in the comments. Folks feel very strongly about this stuff, understandably. Just like color blindness, some people are sensitive to this stuff and others "can't see it." One person in the blogs didn't like go for "indiscernible" and showed a screenshot. Here's the deal. If you are running VS2010 RC, you don't have this fix. This will be in the RTM. Here's a 100% screenshot, followed by the zoomed in version. The takeaway is this. If you didn't like the rendering before, you will now. This is/was some subtle stuff, but it's indiscernible in the RTM, so be happy! I took the screenshot from a daily build, not the actual RTM, which hasn't happened yet.

更新:在评论中对此有些困惑。 可以理解的是,人们对这种东西的感觉非常强烈。 就像色盲一样,有些人对这种东西很敏感,而另一些人“看不到”。 博客中的一个人不喜欢“听不清”,并显示了屏幕截图。 这是交易。 如果您运行的是VS2010 RC,则没有此修复程序。 这将在RTM中。 这是100%的屏幕截图,然后是放大的版本。 要点是这个。 如果您以前不喜欢渲染,现在就可以。 这是/有些细微的东西,但是在RTM中是不可识别的,所以请开心! 我截取了每日构建的屏幕快照,而不是实际的RTM,但尚未发生。

image

Blown up:

爆炸:

image

Click on these side-by-side images from the WPF Text Blog to enlarge and compare. VS2008 with GDI rendering is on the left and VS2010 (a post RC-build) with this fix is on the right. Of course, the release of .NET 4 will have this fix.

单击WPF文本博客中的这些并排图像以进行放大和比较。 带有GDI渲染的VS2008位于左侧,带有此修复程序的VS2010(RC构建后)位于右侧。 当然,.NET 4发行版将具有此修复程序。

In the comments on the WPF Text Blog, Rick Brewster, the author of Paint.NET suggests that we can really analyze these images using an XOR in Paint.NET.

WPF文本博客Rick Brewster的评论中, Paint.NET的作者建议我们可以使用Paint.NET中的XOR来真正分析这些图像。

I've done just that here, taking the dark text on a white background and XORing it. Then, for visibility, I've inverted the result. This shows just the differences in pixels between the two rendering paths. Can't see much? That's the point.

我已经在这里做完了,将白色背景上的深色文字与XOR在一起。 然后,为了获得可见性,我将结果取反了。 这仅显示了两个渲染路径之间的像素差异。 看不到多少? 这才是重点。

XOR and Inverted Text between the GDI and WPF rendering paths in VS2010 and .NET 4 WPF

To quote from the WPF Blog comments: "If you can’t tell a difference between the screenshots of VS2008 and VS2010, then you should not be able to tell the difference between GDI and another WPF app."

引用WPF博客的评论: “如果您无法分辨VS2008和VS2010的屏幕截图之间的区别,那么您就无法分辨GDI和另一个WPF应用之间的区别。”

Also, note that this applies to all WPF apps on .NET 4. It's a general fix that's not VS2010 specific. Enjoy. I'll be happy when this is out and everyone's using it, including my favorite WPF app, Evernote.

另外,请注意,这适用于.NET 4上的所有WPF应用程序。这是通用修复程序,而不是VS2010特定的。 请享用。 当它发布并且所有人都在使用它时,我会感到非常高兴,包括我最喜欢的WPF应用程序Evernote。

* I don't know anyone at Evernote, I'm just a fan and I read the comments on their blog. I speak only for me on this issue.

*我在Evernote上不认识任何人,我只是一个粉丝,我在他们的博客上阅读了评论。 我只在这个问题上为我发言。

翻译自: https://www.hanselman.com/blog/wpf-and-text-blurriness-now-with-complete-clarity

wpf密码文本框默认文本

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值