有没有办法用 .Net 3.5 模拟 WPF 中的 UseLayoutRounding

发布于 2024-10-10 02:43:53 字数 105 浏览 0 评论 0原文

出于安装原因,我想在我的应用程序中使用 3.5。我唯一缺少的功能是 UseLayoutRounding,它与我的自定义控件配合得非常好。有没有办法在3.5中模拟UseLayoutRounding?

For installation reasons, I'd like to use 3.5 in my application. The only feature that I would be lacking is UseLayoutRounding, which worked very nicely with my custom controls. Is there a way to emulate UseLayoutRounding in 3.5?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

放低过去 2024-10-17 02:43:53

如果有人仍然需要解决方法,请参阅以下链接,查找 Thomas Levesque 评论:
http://tech.pro/tutorial/1062/wpfs-most-important -属性-uselayoutrounding

我们在 WPF 3.5 项目中遇到了类似的问题,最终我们通过将 RenderOptions.BitmapScalingMode 设置为 NearestNeighbor 并以原始尺寸显示图像 (Stretch=None) 解决了该问题

<Image Source="/namespace;component/Resources/image.png" Stretch="None" RenderOptions.BitmapScalingMode="NearestNeighbor"/>

但这并不能解决不同系统上的 DPI 问题。

In case someone still need a workaround, here's the link, look for the Thomas Levesque comment:
http://tech.pro/tutorial/1062/wpfs-most-important-property-uselayoutrounding

We had a similar issue at work in a WPF 3.5 project, and eventually we solved it by setting RenderOptions.BitmapScalingMode to NearestNeighbor and displaying the images in their original size (Stretch=None)

<Image Source="/namespace;component/Resources/image.png" Stretch="None" RenderOptions.BitmapScalingMode="NearestNeighbor"/>

This would not solve problems with DPI on different systems though.

亣腦蒛氧 2024-10-17 02:43:53

根据您的具体要求,SnapsToDevicePixels="true" 可能就足够了。

Depending on your exact requirements, SnapsToDevicePixels="true" may be sufficient.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文