Share via

ReportViewer winform Preview print win10 print content is not centered

mengyuan bai 0 Reputation points
2023-02-03T02:45:11.34+00:00

I used ReportViewer to load the rdlc report and preview and print, but the contents did not display in the center when the resolution of win10 system was 125%, but the contents displayed in the center normally when I switched to the 100% resolution and then preview and print. May I ask how to deal with this problem in the code? I haven't found a better solution yet.

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


1 answer

Sort by: Most helpful
  1. Reza Aghaei 4,996 Reputation points Volunteer Moderator
    2023-02-03T02:58:28.3033333+00:00

    Have you made your application DPI aware?

    Try making your application DPI-Aware:

    1. Add new Item, and search for manifest. Choose Application Manifest File to your project.
    2. In the app.manifest file, uncomment the part that is related to DPI-Awareness:
         <application xmlns="urn:schemas-microsoft-com:asm.v3">
           <windowsSettings>
             <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
           </windowsSettings>
         </application>
      
    3. Then in your app.config file, add EnableWindowsFormsHighDpiAutoResizing setting its value to true:
         <appSettings>
           <add key="EnableWindowsFormsHighDpiAutoResizing" value="true"/>
         </appSettings>
      

    Now when you run the application, on different DPI everything should work well.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.