Report Viewer - the problem of scaling when changing the DPI of the system

I have a Winforms application (in Visual Studio 2010) that contains a Report Viewer control that views and prints an A4 report.

One user has a Windows font size set to 150% (i.e. changing the DPI of the system), and when he launches a report, it decreases to 2/3 in both the report view and the print report.

The AutoScaleMode property of the form containing the report viewer is set to Font, although this does not affect the report if I change it.

This is not a font problem (missing / scaling), since I have an example program to demonstrate the problem, which contains only a rectangle that spans the entire page.

It seems that I need to somehow indicate in the report itself that it should be displayed with a resolution of 96 dpi, regardless of the value of the dpi parameter in the system, but I can not see where I can indicate this. What am I missing?

Thanks David

+6
source share
1 answer

I ran into the same problem. WinForms ReportViewer is already DPI aware and will do its own scaling. You just need to tell the system that your DPI application is known so that the system does not try to scale it after.

Add a manifest to your application if you haven’t already done so, then add the following inside the tag:

<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" > <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> <dpiAware>true</dpiAware> </asmv3:windowsSettings> </asmv3:application> 

You can also use the SetProcessDPIAware API function, but it is recommended: http://msdn.microsoft.com/en-us/library/ms633543.aspx

+4
source

All Articles