diff options
| author | Roy <Roy.mail.net@gmail.com> | 2023-04-26 16:23:07 +0300 |
|---|---|---|
| committer | Roy <Roy.mail.net@gmail.com> | 2023-04-26 16:23:07 +0300 |
| commit | 07a75244fe05eb4b2b0b628ec8f038cced238579 (patch) | |
| tree | 77c9d16c2632e2f0f36a533cf6e0bff2ffac0de9 /Software/Visual_Studio/PPC/Tango.PPC.UI/Helpers/DpiHelper.cs | |
| parent | f86efbca4aac00a1a4e6d290feca1a0236c2d828 (diff) | |
| download | Tango-07a75244fe05eb4b2b0b628ec8f038cced238579.tar.gz Tango-07a75244fe05eb4b2b0b628ec8f038cced238579.zip | |
Eureka UI Screen.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Helpers/DpiHelper.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Helpers/DpiHelper.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Helpers/DpiHelper.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Helpers/DpiHelper.cs new file mode 100644 index 000000000..0d0ac9f1e --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Helpers/DpiHelper.cs @@ -0,0 +1,36 @@ +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. + { + } + } + } +} |
