微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Silverlight - UseLayoutRounding

目中有个复杂的自定义控件,运行程序时,控件上的多个TextBox的边框比正常的TextBox边框要模糊,显得很难看。调试多次后发现,包含TextBox的Grid使用了如下属性值 UseLayoutRounding="false" 将该值设为true (该属性认值也为true),问题解决。查阅一下该属性的文档,原来该属性设为true就是解决subpiexl展示时可能会引起的界面模糊等问题:

 

The intention of layout rounding is to prevent subpixel rendering logic from producing antialiasing effects that generally are regarded as a poor visual presentation. One of the most extreme examples of this would be if you had a single-pixel straight black line on exactly a half-pixel boundary of the pixel grid. Subpixel rendering would average the pixels on either side of the .5 division. Instead of a single-pixel line of 100% black,it would render a 2-pixel wide line of 50% gray.

http://msdn.microsoft.com/en-us/library/cc896566(VS.95).aspx

 

使用整数来定位界面元素的位置,亦可避免类似的界面显示问题:

http://blogs.silverlight.net/blogs/msnow/archive/2009/03/26/silverlight-tip-of-the-day-102-use-integers-for-layout-calculations.aspx

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐