这个示例展示了如何在 Ribbon 打印预览 窗体中显示报表文档,其中使用了 ReportPrintTool,并调用了 PrintTool.ShowRibbonPreview 或 PrintTool.ShowRibbonPreviewDialog 方法。
要使本示例能正确工作,则派生于 XtraReport 类的 XtraReport1 子类应该存在于示例应用程序中。 (译者注: 不要忘了把 DevExpress.XtraPrinting.vxx.x.dll 程序集添加到项目的引用,其中 vxx.x 表示具体的版本号,例如 DevExpress.XtraPrinting.v10.2.dll)
C# | 复制代码 |
---|---|
using System; using System.Windows.Forms; using DevExpress.LookAndFeel; using DevExpress.XtraReports.UI; // ... private void Form1_Load(object sender, EventArgs e) { XtraReport1 report = new XtraReport1(); ReportPrintTool printTool = new ReportPrintTool(report); // Invoke the Ribbon Print Preview form modally, // and load the report document into it. printTool.ShowRibbonPreviewDialog(); // Invoke the Ribbon Print Preview form // with the specified look and feel setting. printTool.ShowRibbonPreview(UserLookAndFeel.Default); } |
Visual Basic | 复制代码 |
---|---|
Imports System Imports System.Windows.Forms Imports DevExpress.LookAndFeel Imports DevExpress.XtraReports.UI ' ... Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load Dim report As New XtraReport1() Dim printTool As New ReportPrintTool(report) ' Invoke the Ribbon Print Preview form modally, ' and load the report document into it. printTool.ShowRibbonPreviewDialog() ' Invoke the Ribbon Print Preview form ' with the specified look and feel setting. printTool.ShowRibbonPreview(UserLookAndFeel.Default) End Sub |
下面的插图展示了 Ribbon 打印预览窗体。