Visual Studio 2010: text becoming blurry when scrolling
I have a problem with Visual Studio 2010. It happens when I scroll down/up, for example, in properties window. Its content becomes blurry for milliseconds.
It also happens in my own WPF applications when I use a “ScrollViewer”.
Does an开发者_StackOverflow中文版ybody know how to solve it?
In your own WPF applications it is possible to constrain scroll offsets to device pixels by using a custom IScrollInfo
implementation. This is easy enough to do. Note that you will have to get the actual screen DPI to do the calculation.
In Visual Studio there is no "reasonable" way to fix it. Obviously you could hack up the VS.NET executables to include your own IScrollInfo implementation, but I wouldn't recommend it!!
Just about the only way to avoid the problem is to avoid WPF entirely. As nice as it is in some ways, it still1 doesn't get text entirely correct. And yes, WPF is the source of the problem in Visual Studio -- as of VS 2010 they switched parts of it to use WPF.
1"still", in this case referring to the fact that it used to be even worse. As of .NET 4.0 they've fixed some of the most egregious problems, but (as you've seen) it's still not really right.
I had the same problem. There is actually a way to fix this while scrolling. Just add those 3 attributes to your content control:
SnapsToDevicePixels="True" UseLayoutRounding="True" TextOptions.TextFormattingMode="Display"
Just note that the text might not look as smooth as it should while scrolling (instantly goes away once you stop scrolling though)
精彩评论