mirror of
https://github.com/jie65535/GrasscutterCommandGenerator.git
synced 2025-06-07 22:59:14 +08:00
33 lines
846 B
C#
33 lines
846 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace GrasscutterTools.Utils
|
|
{
|
|
internal class HighDPIUtil
|
|
{
|
|
public static void SetDpiAwareness()
|
|
{
|
|
var dpiAwareness = ProcessDpiAwareness.PerMonitorDpiAware;
|
|
var hresult = SetProcessDpiAwareness(dpiAwareness);
|
|
if (hresult != 0)
|
|
{
|
|
throw new System.ComponentModel.Win32Exception(hresult);
|
|
}
|
|
}
|
|
|
|
[DllImport("shcore.dll")]
|
|
private static extern int SetProcessDpiAwareness(ProcessDpiAwareness value);
|
|
|
|
private enum ProcessDpiAwareness
|
|
{
|
|
DpiUnaware = 0,
|
|
SystemDpiAware = 1,
|
|
PerMonitorDpiAware = 2
|
|
}
|
|
}
|
|
}
|