Developing DPI Aware Applications

Windows Mobile 6.5

As display technology improves, it is becoming possible to fit more pixels into the same area. This additional resolution can be used to fit more items on the screen, or it can be used to draw the same items sharply. When used for this latter application, the display is said to have increased in dots per inch (DPI), a logical value representing how densely packed with pixels a display area is.

Print media has taken advantage of high DPI technology for a long time. A document printed on a 1200-dpi printer prints the same amount of text as a 300-dpi printer, but the text is much sharper.

Windows® phones have traditionally used 96-DPI displays, but in the future they will run at higher DPI resolutions. Upgrading your application to support DPI awareness will not only ensure correct appearance on high-DPI devices, but will also prepare your application for these high-DPI advantages:

  • Sharper text – The most noticeable improvement that comes with almost no cost. Every application that is DPI aware and uses TrueType fonts inherits this improvement.
  • More detailed graphics – If steps are taken to provide high-resolution bitmaps, applications can use the increased resolution to display more detailed icons and graphics.

The following list shows the key issues to focus on when developing applications to determine the DPI of a device and take advantage of high-DPI displays:

  • Layout
  • Text and fonts
  • Images

The header file DeviceResolutionAware.h provides a series of functions that can be used to correctly display text, graphics and images on a variety of resolutions.

User Interface Layout

Describes how elements should be laid out using scaled positions and sizes, or relative to controls, fonts, or system metrics.

System Metrics

Describes how to obtain system metrics that offer information about the user's system.

Drawing with DPI Aware Thick Pens

Describes how OEM applications should scale the width of any pens with which it draws, in order to be DPI aware.

Internet Explorer and HTML Controls Exception

Describes how HTML layouts are an exception to the rule that all pixel coordinates should be scaled.

DPI Aware Text and Fonts

Describes how OEMs should use points to specify the font size in order to create fonts for Windows® phones.

High DPI Images

Describes how to manually recreate high-visibility graphics for high DPI images.

Multiple Images

Describes how to scale the loaded bitmap, based on the actual DPI of the device.

Images in Static Controls

Describes how Windows® phones automatically scale bitmaps in static controls on high-DPI displays.

High Resolution Legacy Support

Describes how Windows® phones provide an emulation layer for backwards compatibility between older applications and devices with high-resolution displays.

Community Additions