using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace Tango.PPC.UI.Helpers { public static class DpiHelper { private enum ProcessDPIAwareness { ProcessDPIUnaware = 0, ProcessSystemDPIAware = 1, ProcessPerMonitorDPIAware = 2 } [DllImport("shcore.dll")] private static extern int SetProcessDpiAwareness(ProcessDPIAwareness value); public static void SetDpiAwareness() { try { if (Environment.OSVersion.Version.Major >= 6) { SetProcessDpiAwareness(ProcessDPIAwareness.ProcessPerMonitorDPIAware); } } catch (EntryPointNotFoundException)//this exception occures if OS does not implement this API, just ignore it. { } } } }