zoukankan      html  css  js  c++  java
  • How to: Access the ReportViewer Control 如何:访问报表查看器控件

    This example demonstrates how to access the ReportViewer control used to display reports in XAF Mobile applications.

    此示例演示如何访问用于在 XAF 移动应用程序中显示报表的报表查看器控件。

    In this topic, it is assumed that you have an XAF application that uses the Reports V2 Module, and you have created one or more reports (see Reports V2 Module Overview).

    在本主题中,假定您有一个使用报表 V2 模块的 XAF 应用程序,并且您创建了一个或多个报表(请参阅报表 V2 模块概述)。

    When a user previews a report, a Mobile application displays a Detail View that contains a single View Item - MobileReportViewerViewItem. This View Item wraps the ReportViewer control.

    当用户预览报表时,移动应用程序将显示包含单个视图项的详细信息视图 - 移动报表查看器查看项目。此视图项换行报表查看器控件。

    Follow the steps below to access the View Item.

    • Create a new ObjectViewController<ViewType, ObjectType> descendant. Set the Controller's ViewType parameter to DetailView and the ObjectType parameter to IReportDataV2 - the interface that persistent classes use to store reports.

    • In the overridden OnActivated method, pass the View Item type as the GetItems<T>() method's generic parameter.

    • Handle the View Item's ControlCreated event and use the ReportViewer property to access the control.

    按照以下步骤访问查看项目。

    • 创建新的对象视图控制器 [视图类型,对象类型] 后代。将控制器的 ViewType 参数设置为"详细信息视图",将 ObjectType 参数设置为 IReportDataV2 - 持久类用于存储报表的接口。
    • 在重写的 OnActivated 方法中,将视图项类型作为 GetItems<T>() 方法的泛型参数传递。
    • 处理视图项的控件创建事件,并使用 ReportViewer 属性访问控件。

    The following code demonstrates this Controller:

    以下代码演示此控制器:

    using System;
    using DevExpress.ExpressApp;
    using DevExpress.ExpressApp.ReportsV2;
    using DevExpress.ExpressApp.ReportsV2.Mobile;
    // ...
    public class ReportsCustomizeController : ObjectViewController<DetailView, IReportDataV2> {
        // ...
        protected override void OnActivated() {
            base.OnActivated();
            MobileReportViewerViewItem reportViewItem = 
            View.GetItems<MobileReportViewerViewItem>()[0] as MobileReportViewerViewItem;
            reportViewItem.ControlCreated += delegate (object sender, EventArgs e) {
                MobileReportViewerViewItem mobileReportViewerViewItem = (MobileReportViewerViewItem)sender;
                mobileReportViewerViewItem.ReportViewer.BeforeInitialize = 
                    @"function(args) { args.reportViewerSettings.mobileModeSettings = { readerMode: true }; }";
                //mobileReportViewerViewItem.ReportViewer.OnCustomize = 
                    //@"function(args) { args.previewModel.reportPreview.zoom(0.7); }";
            };
        }
    }
    Note 注意
    Only use the BeforeInitialize or OnCustomize properties in one Controller.
    仅在一个控制器中使用"初始化前"或"自定义"属性。
  • 相关阅读:
    二元关系最小割
    DG观察日志传输
    [WC2007]剪刀石头布——费用流
    备库报 ORA-00313、ORA-00312、ORA-27037
    「清华集训 2017」无限之环
    The listener supports no services
    [SDOI2010]星际竞速——费用流
    ORA-16055: FAL request rejected
    [总结]网络流
    ORA-16047: DGID mismatch between destination setting and standby
  • 原文地址:https://www.cnblogs.com/foreachlife/p/How-to-Access-the-ReportViewer-Control.html
Copyright © 2011-2022 走看看