示例#1
0
 /// <summary>
 /// Tries to enable per-monitor high dpi support if possible (win8.1+), or general high dpi support (vista+).
 /// This can only be set once at process startup. To use this method <see cref="System.Windows.Media.DisableDpiAwarenessAttribute"/>
 /// must be set on the assembly.
 /// </summary>
 /// <returns></returns>
 public static bool EnableHighDpiSupport()
 {
     if (Shcore.IsPlatformSupported)
     {
         return(Shcore.SetProcessDpiAwareness(PROCESS_DPI_AWARENESS.PROCESS_PER_MONITOR_DPI_AWARE));
     }
     return(User32.SetProcessDPIAware());
 }
示例#2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var test = Shcore.SetProcessDpiAwareness(PROCESS_DPI_AWARENESS.PROCESS_PER_MONITOR_DPI_AWARE);

            if (!test)
            {
                var err = new Win32Exception();
            }

            base.OnStartup(e);
        }