Share via


Exercise 2: Run the Application at the 144 DPI Setting

In this exercise, you run the application at the 144 DPI setting, and then compare the UI elements to those at the 96 DPI setting.

Task 1 - Run the Application at the 144 DPI Setting

  1. In Visual Studio 2008, open the HighDPIApp.sln solution.
  2. Set the HighDPINativeApp to be the startup project.
  3. On the Build menu, click Build Solution.
  4. On the Debug menu, click Start Debugging. The application appears, as shown in the following screen shot:

Task 2 - Compare the UI at the 144 DPI Setting to the 96 DPI Setting

The following screen shot shows how the UI of the application looks when running at the 96 DPI setting.

  1. Now compare this UI to the UI from the 144 DPI setting:

The following table summarizes the appearances of the application UI at the 144 DPI setting as compared to at the 96 DPI setting.

UI element

Appearance at 144 DPI

Size of the window frame

Larger

Size of the buttons

Larger

Size of the text

Larger

Clipped text on the buttons

Yes

Clipped text in the window

Yes

Blurry effect

Yes

Note:
Help

Notice that the application is blurry, the text is clipped, and the sizes of the buttons and window frame are increased. This is because the application is incompatible with the default scaling offered by DPI virtualization.

With DPI set to 144, the operating system automatically enables DPI virtualization. Microsoft introduced the concept of DPI virtualization Windows Vista®. It is also known as DPI scaling, which means to scale the text and window size of the applications that are not DPI-aware.

When your application relies solely on DPI virtualization to scale its UI elements, it might produce visual artifacts due to potential incompatibility with the DPI scaling. The preceding sample demonstrated that. To fix the problem, you need to opt out of the DPI virtualization programmatically by declaring your application as DPI-aware.

For applications you have already deployed, you can manually opt them out of the automatic DPI virtualization. For more information about how to do this, see the Appendix: Manually Opting Out of DPI Virtualization.