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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值