Skip to content

Commit

Permalink
attempt to make the HASS.Agent respect high DPI scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
amadeo-alex committed Oct 19, 2024
1 parent 5fc4112 commit c4a2cc0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/HASS.Agent/HASS.Agent/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ private static void Main(string[] args)
}

LocalizationManager.Initialize();

Application.SetHighDpiMode(HighDpiMode.DpiUnaware);

Application.SetDefaultFont(Variables.DefaultFont);

Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
Expand All @@ -96,6 +95,9 @@ private static void Main(string[] args)
if (LaunchedAsChildApplication(args))
return;

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

Variables.MainForm = new Main();

// run (hidden)
Expand Down
7 changes: 4 additions & 3 deletions src/HASS.Agent/HASS.Agent/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->

<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />

</application>
</compatibility>

<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
Expand All @@ -64,7 +64,8 @@
<windowsSettings>
<!-- <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware> -->
<!-- <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware> -->
</windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
</windowsSettings>
</application>


Expand Down

0 comments on commit c4a2cc0

Please sign in to comment.