Skip to content

Commit 7ad0b29

Browse files
Todorarabadzhiev patch 1 (#1756)
* Update windows-forms-report-viewer-scaling-issues-on-higher-dpi.md * Update overview.md * Update windows-forms-report-viewer-scaling-issues-on-higher-dpi.md
1 parent 0627edd commit 7ad0b29

File tree

2 files changed

+72
-13
lines changed

2 files changed

+72
-13
lines changed

embedding-reports/display-reports-in-applications/windows-forms-application/overview.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@ It is recommended that you declare a DPI-aware application by adding a `dpiAware
8585
</assembly>
8686
````
8787

88+
For .NET applications, you need to ensure Windows 10 compatibility in the manifest file, as elaborated in the Microsoft article [High DPI support in Windows Forms](https://learn.microsoft.com/en-us/dotnet/desktop/winforms/high-dpi-support-in-windows-forms):
89+
90+
````XML
91+
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
92+
<application>
93+
<!-- Other Windows distributions may be added -->
94+
95+
<!-- Windows 10 -->
96+
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
97+
</application>
98+
</compatibility>
99+
````
100+
88101
As of Windows 10 Anniversary Update, the Windows runtime has improved the UX for Windows Forms applications that are not DPI-aware. However, this behavior may lead to incorrect calculations of the interactive item positions and it is recommended that you always declare the Windows Forms application as DPI-aware. For more information about DPI-aware desktop applications, refer to the [High DPI Desktop Application Development on Windows](https://learn.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows) MSDN article.
89102

90103
## Keyboard Shortcuts

knowledge-base/windows-forms-report-viewer-scaling-issues-on-higher-dpi.md

Lines changed: 59 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,80 @@ res_type: kb
2222
</tr>
2323
<tr>
2424
<td>Report Viewer</td>
25-
<td>Win Viewer</td>
25+
<td>WinForms Viewer</td>
2626
</tr>
2727
</table>
2828

2929
## Description
3030

31-
When using [Windows Forms Report Viewer]({%slug telerikreporting/using-reports-in-applications/display-reports-in-applications/windows-forms-application/overview%}) on a machine with DPI scale factor higher than 96 (100%), Windows will resize the bitmap images in the application according to the current DPI value. This makes the report viewer and the report content blurry or is sized incorrectly in many common usage scenarios. Also, when printing the report, the application will scale the report contents incorrectly, because it cannot detect the current machine's DPI settings and the DPI value will always be reported as 96 dots per inch.
31+
When using [Windows Forms Report Viewer]({%slug telerikreporting/using-reports-in-applications/display-reports-in-applications/windows-forms-application/overview%}) on a machine with a DPI scale factor higher than 96 (100%), Windows will resize the bitmap images in the application according to the current DPI value. This makes the report viewer and the report content blurry or incorrectly sized in many common usage scenarios. Also, when printing the report, the application will scale the report contents incorrectly, because it cannot detect the current machine's DPI settings, and the DPI value will always be reported as 96 dots per inch.
3232

3333
## Cause\Possible Cause(s)
3434

35-
By default, WinForms applications are declared as DPI Unaware. Declaring the application in which the Windows Forms Report Viewer is used as `DPI-aware` application would resolve the issues.
35+
By default, WinForms applications are declared as DPI-unaware. Declaring the application in which the Windows Forms Report Viewer is used as a `DPI-aware` application would resolve the issues.
3636

3737
## Solution
3838

39-
The recommended approach is setting the `dpiAware` element in your application to avoid further scaling, visual or interaction issues. To do so, you have to add a manifest file at the root of the application with the following content:
39+
The recommended approach is to set the `dpiAware` element in your application to avoid further scaling, visual, or interaction issues. To do so, you have to add a manifest file at the root of the application with the following content:
4040

41-
````XML
41+
* .NET Framework:
42+
43+
````XML
4244
<?xml version="1.0" encoding="utf-8"?>
43-
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
44-
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
45-
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
46-
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
47-
<dpiAware>True/PM</dpiAware>
48-
</asmv3:windowsSettings>
49-
</asmv3:application>
50-
</asmv1:assembly>
45+
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
46+
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
47+
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
48+
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
49+
<dpiAware>True/PM</dpiAware>
50+
</asmv3:windowsSettings>
51+
</asmv3:application>
52+
</asmv1:assembly>
53+
````
54+
55+
* .NET:
56+
57+
Ensure Windows 10 compatibility in the manifest file, as elaborated in the Microsoft article [High DPI support in Windows Forms](https://learn.microsoft.com/en-us/dotnet/desktop/winforms/high-dpi-support-in-windows-forms):
58+
59+
````XML
60+
<?xml version="1.0" encoding="utf-8"?>
61+
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
62+
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
63+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
64+
<security>
65+
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
66+
<!-- UAC Manifest Options may be added if needed -->
67+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
68+
</requestedPrivileges>
69+
</security>
70+
</trustInfo>
71+
72+
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
73+
<application>
74+
<!-- Other Windows distributions may be added -->
75+
76+
<!-- Windows 10 -->
77+
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
78+
79+
</application>
80+
</compatibility>
81+
82+
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
83+
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
84+
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
85+
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
86+
87+
<application xmlns="urn:schemas-microsoft-com:asm.v3">
88+
<windowsSettings>
89+
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
90+
</windowsSettings>
91+
</application>
92+
93+
<!-- OTHER CONTENT FOLLOWS -->
94+
95+
</assembly>
5196
````
5297

98+
5399
## Notes
54100

55101
For reference, check our demos located in the Telerik Reporting installation folder, for example: *C:\Program Files (x86)\Progress\Telerik Reporting <VERSION>\Examples\CSharp|VB\WinFormsDemo*. The `dpiAware.manifest` file is placed at the root of the application.

0 commit comments

Comments
 (0)