Enable High DPI support

GCT的高DPI支持
This commit is contained in:
剧毒的KCN
2024-06-23 02:33:21 +08:00
parent 3d160f9b90
commit 45eed49ab9
3 changed files with 39 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
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
}
}
}