mirror of
https://github.com/jie65535/GrasscutterCommandGenerator.git
synced 2025-10-22 20:09:46 +08:00
Enable High DPI support (#231)
This commit is contained in:
32
Source/GrasscutterTools/Utils/HighDPIUtil.cs
Normal file
32
Source/GrasscutterTools/Utils/HighDPIUtil.cs
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user