Krypton-Suite-Legacy-Archive / Krypton-NET-5.470

A update to Component factory's krypton toolkit to support the .NET 4.7 framework.
BSD 3-Clause "New" or "Revised" License
78 stars 20 forks source link

[BUG] Scaling of Krypton Forms with multiple monitors #190

Closed PontusLindberg closed 5 years ago

PontusLindberg commented 5 years ago

Scaling of Krypton forms do not work when dragging them between monitors with different scaling.

When you use multiple monitors and they have different scaling (for example a full hd laptop with 100% and a 4K screen with 150%), Krypton forms are not scaled according to the monotor settings when dragging them from one monitior to the other. Regular windows forms are scaled depending on the settings for each monitor.

I use the 4.6 version.

Any feedback would be greatly appreciated.

Smurf-IV commented 5 years ago

Just Checking: @PontusLindberg Have you set the following in your app.config

 <System.Windows.Forms.ApplicationConfigurationSection>
     <add key="DpiAwareness" value="PerMonitorV2" />
 </System.Windows.Forms.ApplicationConfigurationSection>

And in the App.Manifest:

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

  <!-- 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. -->
  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
    </windowsSettings>
  </application>
Smurf-IV commented 5 years ago

May be related to #73

PontusLindberg commented 5 years ago

Thanks @Smurf-IV, I will check and get back to you.

PontusLindberg commented 5 years ago

@Smurf-IV , the Krypton forms we use are in dlls which are 'add-ons' to an Autodesk application. As long as we stick to regular Windows forms, those are scaled correctly when dragged between monitors. When we change to Krypton, the scaling when dragging between monitors stops working. When we change back to Windows forms, it works fine again.

PWagner1 commented 5 years ago

Have a look at this: https://docs.microsoft.com/en-us/dotnet/framework/winforms/high-dpi-support-in-windows-forms I thought that the app.config configuration was only supported in 4.7 and higher?

PWagner1 commented 5 years ago

EDIT: Yes high DPI awareness support app.config only exists in .NET 4.7 or higher: Starting with the .NET Framework 4.7, Windows Forms includes enhancements for common high DPI and dynamic DPI scenarios.

PontusLindberg commented 5 years ago

Aha, so we need need newer Krypton dlls?

PWagner1 commented 5 years ago

Yes, 5.470 has this configuration built into it, but you'll also may need to re-target your projects to .NET 4.7 or newer.

PWagner1 commented 5 years ago

Removed bug label, as .NET Framework 4.7 or higher is required for high DPI scaling.