
最近よく使っているアプリを、違うPCで起動したらメニュー、フォント等がボケて表示。
今更ですが解決方法をメモ
namespace TEST
{
static class Program
{
[System.Runtime.InteropServices.DllImport("user32.dll")] // 追加
private static extern bool SetProcessDPIAware(); // 追加
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
SetProcessDPIAware(); // 追加
Application.Run(new TEST());
}
}
}
// 96->100%, 120->125%, 144->150% Graphics graphics = this.CreateGraphics(); float scale = graphics.DpiX / 96; // 1.0, 1.25, 1.50
オーソドックスなアプリなら高DPI設定の変更 – 高いDPIスケールの動作を上書きでOKですね。

コメント