zoukankan      html  css  js  c++  java
  • 在WPF中加载Windows中的ReportViewer控件

    在项目中同事需要将Reporter中的控件嵌入到WPF中,所以找了一些相关资料

    与大家共同学习

     

    首先,需要向项目中的reference添加两个dll,一个是.NET库中的System.Windows.Forms

    另一个是 Microsoft.ReportViewer.WinForms控件

    然后WPF中的Window引入域名空间

    <Window x:Name="main" x:Class="WpfApplication_Demo.MainWindow"

    xmlns:wf ="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"

    xmlns:rv="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="Hosting Windows Forms Control In WPF" Height="300" Width="650">

    最后就是加载我们的ReportViewer控件了

    示例如下:

    <Grid>

    <DockPanel>

    <WindowsFormsHost>

    <rv:ReportViewer x:Name="_reportViewer" Width="300" ProcessingMode="Remote">

     

    </rv:ReportViewer>

    </WindowsFormsHost>

    </DockPanel>

    </Grid>

    接下来 就是写后台代码了

    public MainWindow()

    {

    InitializeComponent();

    //_reportViewer.Load += ReportViewer_Load;

    _reportViewer.ServerReport.ReportPath = "/MESReprots/TOP5";

    _reportViewer.ServerReport.ReportServerUrl = new Uri("http://192.168.6.20/reportserver");

    _reportViewer.RefreshReport();

     

    }

    F5运行,大功告成!

  • 相关阅读:
    FHS Filesystem Hierarchy Standard(文件系统层次化标准)
    Linux文件类型
    cd、rm、ls命令
    基础内容
    Linux命令格式及使用方法
    Linux一些概念
    SHELL脚本的成分
    SHELL脚本
    Loadrunner关联
    赋值语句
  • 原文地址:https://www.cnblogs.com/xiaoni/p/3288524.html
Copyright © 2011-2022 走看看