Over a million developers have joined DZone.

Creating Per-Monitor DPI-Aware Applications Code Sample

DZone 's Guide to

Creating Per-Monitor DPI-Aware Applications Code Sample

· ·
Free Resource

Microsoft Developer Network Samples Per-Monitor Aware WPF Sample


This sample demonstrates updating a Windows Presentation Foundation (WPF) application to be per-monitor DPI-aware.

The sample consists of two projects:

  • NativeHelpers.vcxproj The native helper project that implements the core functionality to make a WPF application per-monitor DPI-aware
  • WPFApplication.csproj A sample WPF application that inherits from the PerMonitorDPIWindow base class and showcases how the application window resizes when the user moves the window to another monitor with a different DPI or when the user changes the DPI by adjusting the Display slider in Control Panel.


In the coming year we're going to start seeing more and more of this, where our uses not only have multiple monitors but have them set at different DPI settings. This code sample will help you handle that gracefully in your LOB/WPF applications.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}