Search code examples
wpfclarity

Why everything in WPF is blurry?


Can someone explain why everything in WPF is blurry? Is this something that can be fixed?


Solution

  • The reason for this is the anti-aliasing system which spreads the line over multiple pixels if it doesn't align with physical device pixels.

    WPF is resoultion independent. This means you specify the size of an user interface element in inches, not in pixels. A logical unit in WPF is 1/96 of an inch. This scale is chosen, because most screens have a resolution of 96dpi. So in most cases 1 logical unit matches to 1 physical pixel. But if the screen resolution changes, this rule is no longer valid.

    All WPF controls provide a property SnapsToDevicePixels. If set to true, the control ensures the all edges are drawn excactly on physical device pixels. But unfortunately this feature is only available on control level.

    Source: Draw lines excactly on physical device pixels