From dd76abdbb4860513bc4cd1c8849a59422b3ce2f5 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 27 May 2026 11:28:16 -0500 Subject: [PATCH] Add highdpi text/control setting, detect dark MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Detects for system dark mode on startup since many users don't know about dark mode. Won't override any existing setting, just detects if no cfg exists `new()`. Text/control dpi scaling is opt-in for high dpi users, reduces font blurriness. https://github.com/kwsch/PKHeX/discussions/4458#discussioncomment-12362513 The hover-preview was rewritten in the past year to directly paint instead of updating many controls, so it works fine with `DpiUnawareGdiScaled`. I've not checked extensively to see if anything becomes broken, so user beware 💫 --- PKHeX.WinForms/Program.cs | 2 ++ PKHeX.WinForms/Settings/StartupSettings.cs | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/PKHeX.WinForms/Program.cs b/PKHeX.WinForms/Program.cs index aa97949f1..c91f56e53 100644 --- a/PKHeX.WinForms/Program.cs +++ b/PKHeX.WinForms/Program.cs @@ -39,6 +39,8 @@ static Program() if (Settings.Startup.DarkMode) Application.SetColorMode(SystemColorMode.Dark); + if (Settings.Startup.HighDpiText) + Application.SetHighDpiMode(HighDpiMode.DpiUnawareGdiScaled); } [STAThread] diff --git a/PKHeX.WinForms/Settings/StartupSettings.cs b/PKHeX.WinForms/Settings/StartupSettings.cs index 0d98eb505..a320d513e 100644 --- a/PKHeX.WinForms/Settings/StartupSettings.cs +++ b/PKHeX.WinForms/Settings/StartupSettings.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Windows.Forms; using PKHeX.Core; namespace PKHeX.WinForms; @@ -12,11 +13,14 @@ public sealed class StartupSettings : IStartupSettings public string Version { get; set; } = string.Empty; [LocalizedDescription("Use the Dark color mode for the application on startup.")] - public bool DarkMode { get; set; } + public bool DarkMode { get; set; } = Application.SystemColorMode == SystemColorMode.Dark; // auto-detect for new settings, json load preserves any choice. [LocalizedDescription("Force HaX mode on Program Launch")] public bool ForceHaXOnLaunch { get; set; } + [LocalizedDescription("Toggles a higher Dpi rendering mode for the application on startup.")] + public bool HighDpiText { get; set; } // opt-in + [LocalizedDescription("Skips displaying the splash screen on Program Launch.")] public bool SkipSplashScreen { get; set; }