本文介绍了SSRS的高分辨率问题(Microsoft报表查看器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Winforms应用程序(在Visual Studio 2015中),其中包含一个预览和打印报告的Microsoft Report Viewer控件。



一个用户拥有4K分辨率监视器和当他运行报告时,它在微软报告查看器控件中缩小到2/3大小。



当我尝试将此报告导出到PDf时看起来是正确的。



包含Microsoft Report Viewer的表单的AutoScaleMode属性设置为Font,但如果我更改它,它似乎不会影响报表查看器。 />


我需要一些方法在报表查看器控件中指定它应该以96dpi呈现,而不管系统dpi设置如何。有没有办法完全满足我的目的。



我尝试过的事情:



我在我的应用程序清单文件中添加了以下代码,但我无法为我工作。



< 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>

I have a Winforms application (in Visual Studio 2015) that contains a Microsoft Report Viewer control that preview and prints report.

One user has 4K resolution monitor and when he runs the report it is shrunk to 2/3 size in microsoft report viewer control.

when I try to export this report into PDf it look proper.

The AutoScaleMode property of the form containing the Microsoft Report Viewer is set to "Font", although it doesn't seem to affect the report viewer if i change this.

I need some way to specify in the report viewer control itself that it should be rendered at 96dpi regardless of the system dpi setting. Is there any way to full-fill my purpose.

What I have tried:

I have added below code in my application manifest file but I could not work for me.

<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>

推荐答案

public partial class Form1 : Form  
{  
    private void Form1_Load(object sender, EventArgs e)  
    {  
        // Set the processing mode for the ReportViewer to Remote  
        reportViewer1.ProcessingMode = ProcessingMode.Remote;  

        ServerReport serverReport = reportViewer1.ServerReport;  

        // Get a reference to the default credentials  
        System.Net.ICredentials credentials =  
            System.Net.CredentialCache.DefaultCredentials;  

        // Get a reference to the report server credentials  
        ReportServerCredentials rsCredentials =  
            serverReport.ReportServerCredentials;  

        // Set the credentials for the server report  
        rsCredentials.NetworkCredentials = credentials;  

        // Set the report server URL and report path  
        serverReport.ReportServerUrl =   
            new Uri("http:// <Server Name>/reportserver");  
        serverReport.ReportPath =   
            "/AdventureWorks Sample Reports/Sales Order Detail";  

        // Create the sales order number report parameter  
        ReportParameter salesOrderNumber = new ReportParameter();  
        salesOrderNumber.Name = "SalesOrderNumber";  
        salesOrderNumber.Values.Add("SO43661");  

        // Set the report parameters for the report  
        reportViewer1.ServerReport.SetParameters(  
            new ReportParameter[] { salesOrderNumber });  

        // Refresh the report  
        reportViewer1.RefreshReport();  
    }  
}  


这篇关于SSRS的高分辨率问题(Microsoft报表查看器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 00:26