DPI Scaling in Windows Vista

Someone posted a question via the blog recently asking about how Windows Vista supports high DPI displays. Here's a quick summary of how it all works:

You can find the DPI settings in Windows Vista by right click'ing on the desktop and selecting "Personalize", and the clicking "Adjust Font Size (DPI)" in the task list in the green column on the left. This will bring up the "DPI Scaling" control panel.

When you select 120DPI, the system DPI setting changes. At this point, all the UI in the OS itself should scale up as you'd expect - so a character in 8pt font on a 120DPI display with system DPI set to 120 would take up the same amount of physical space as the same character on a 96DPI display with system DPI set to 96. (This form of scaling actually exists in Windows XP SP2 as well, although the UI entry point is more buried, you have to find the control panel for the monitor, and adjust it from there.)

Using this DPI setting works well for all applications that are actually authored in a DPI aware fashion. Nearly all the UI in Windows itself is DPI aware, as is Microsoft Office, but mileage varies with 3rd party applications.

If you happen to be running an application that doesn't work well like this, there is an additional layer of high DPI support in Windows Vista, enabled by desktop composition that you can take advantage of. If you look in the bottom-right corner of the DPI Scaling dialog, there's a button labeled "Custom DPI". Clicking this button opens another dialog where there is a checkbox labeled "Use Windows XP style DPI scaling", and it is checked by default for sizes <=120 DPI and unchecked by default for sizes >120DPI.

Un-checking this checkbox causes Windows to use the desktop composition engine to perform DPI scaling for all applications that don't explicitly mark themselves as DPI aware via manifest. In this case, the composition engine will use your graphics hardware to scale the bitmap output of the window to a larger size, and apply an input transform to any mouse-clicks on the window to route them back to the right place in "real coordinates" for the application. The OS will also virtualize the system DPI for that application, so that it thinks it is running at 96DPI. This applies to most traditional Win32, GDI based applications.

Newer applications that are built using Windows Presentation Foundation are DPI aware by default, as WPF doesn't give the developer access to actual device pixels in the vast majority of normal cases. So new applications designed for Windows Vista will scale up using WPF's vector engine rather than simple bitmap scaling.

I hope this clears up any latent questions folks may have about this.

UPDATE (1/22/2009):

There are now documents on MSDN that describe behavior and best practices with respect to high-DPI on Windows Vista that are better resources to use than this post.

· https://go.microsoft.com/fwlink/?LinkID=129586 for the PDF version

· https://go.microsoft.com/fwlink/?LinkID=129588 for the XPS version