Saturday, April 12, 2008

Resolution Independence in WPF

This is the first of a series of posts that explains the aspects of WPF and C#. One of the first technologies explained in Pro WPF in C# 2008 is the support for resolution independence in WPF applications. In standard windows forms applications, scaling is not supported and this becomes more of an issue as manufacturers cram more pixels into LCD displays which results in a higher DPI (Dots per inch) rating. A traditional display has a pixel density of 96 DPI but newer displays can have pixel densities of 120DPI and up, this results in windows and controls decreasing in size rather than increasing quality and clarity. How is this overcome? Resolution Independence. When you make a button with dimensions of 96 x 96 on your 96 DPI system, it displays a 1 inch button. When a user runs your application on 120DPI system, windows assumes each individual pixel is equal to 1.25 pixels, this means that the button will be 1 inch in length when displayed on a standard or a high pixel density monitor. Instead of changing the size, the button has increased quality as more pixels are used to display it. This is all done without any input from the user, most people will not even notice it :)

I'm not going to go over the mathematics involved in reaching this independence but I just wanted to go over the basics. If you have any issues or tips with this post, please drop a comment :) I'm still learning so give me a chance :)

3 comments:

Anonymous said...

alas one day I hope to get a high res monitor, but until then i shall keep dreaming lol

snehaliteng said...

I think Microsoft should be make some vactor graphics that will display same on all kinds of monitors. with high quality. DPI should be only masured in Inches. so we can use and see the graphics properly.

Anonymous said...

I have developed the application but in some monitors the windows are not properly visible means controls are not visible how to achieve resolution independence...