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


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/jameszhou/archive/2009/10/26/4730655.aspx

posted @ 2010-12-08 11:52  scarbean  阅读(345)  评论(0编辑  收藏  举报