On hi-res monitor calls to GemBox cause the winforms app to resize (25%)

I have an Winforms app that functions just fine on a 4K monitor. However, upon adding GemBox Spreadsheet, when an xlsx file of pdf file is saved, the app is scaled down to approx. 25% of it normal size. It appears that GemBox is changing the app scaling for some unknown reason. This is rendering the app unusable, even thought the GemBox functionality is working and the saved file is correct.

Any insight in why this is occurring. Does GemBox not support high resolution monitors?

Thanks, Lindsey.

Hi Lindsey,

This problem occurs when loading a WPF related assemblies into a Windows Forms application’s app domain when Windows has a custom scaling applied to it.

In other words, just by calling System.Reflection.Assembly.Load method with the “PresentationFramework” assembly should reproduce the same issue.

GemBox.Spreadsheet checks if WPF is available on the system, and if it is, it will use it when rendering the spreadsheet.

The WPF is chosen (from all supported text formatting modes) because it, currently, supports the most complex text layout (for example, for right-to-left scripts).

Anyway, to resolve this issue you can use the following:

  1. Add a reference to “WindowsBase”.
  2. Inside the “AssemblyInfo.cs” file add the following line of code:
    [assembly: System.Windows.Media.DisableDpiAwareness]

Does this solve your issue?

Regards,
Mario

Thanks Mario. Yes this resolved the problem. Thank-you. Lindsey.