本文介绍了向Crystal report viewer添加多个报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 在我的带有c#的windows应用程序中,我有许多不同的水晶报告,我想在一个水晶报告查看器中显示它们In my windows application with c#, I have many different crystal report and I want to show them all in one crystal report viewer推荐答案 private void FormCrystalRepotViewer_Shown(object sender, EventArgs e){ ReportDocument crReport = crArrReport[0]; crystalReportViewer.ReportSource = crReport; crystalReportViewer.Zoom(100); crystalReportViewer.PrintMode = CrystalDecisions.Windows.Forms.PrintMode.PrintToPrinter; tcTabControl.TabPages[0].Text = arrRaporlar.Get(0).sReportName; for (int i = 1; i < crArrReport.Count; i++) { crReport = crArrReport[i]; CrystalDecisions.Windows.Forms.CrystalReportViewer crview = new CrystalDecisions.Windows.Forms.CrystalReportViewer(); crview.ReportSource = crReport; crview.Zoom(100); crview.PrintMode = crystalReportViewer.PrintMode; crview.ActiveViewIndex = -1; crview.BorderStyle = crystalReportViewer.BorderStyle; crview.Cursor = crystalReportViewer.Cursor; crview.Dock = crystalReportViewer.Dock; crview.Location = crystalReportViewer.Location; crview.Size = crystalReportViewer.Size; crview.TabIndex = 0; crview.ToolPanelView = crystalReportViewer.ToolPanelView; crview.ShowParameterPanelButton = crystalReportViewer.ShowParameterPanelButton; crview.ShowLogo = crystalReportViewer.ShowLogo; crview.ReportRefresh += new CrystalDecisions.Windows.Forms.RefreshEventHandler(this.crystalReportViewer_ReportRefresh); TabPage page = new TabPage(arrRaporlar.Get(i).sReportName); tcTabControl.TabPages.Add(page); page.Controls.Add(crview); page.AutoScroll = true; }}private void crystalReportViewer_ReportRefresh(object source, CrystalDecisions.Windows.Forms.ViewerEventArgs e){ e.Handled = true; ParametreleriKontrolEt(); crystalReportViewer.ReportSource = crArrReport[0]; for (int i = 1; i < crArrReport.Count; i++) { CrystalDecisions.Windows.Forms.CrystalReportViewer crview = new CrystalDecisions.Windows.Forms.CrystalReportViewer(); crview = tcTabControl.TabPages[i].Controls[0] as CrystalDecisions.Windows.Forms.CrystalReportViewer; crview.ReportSource = crArrReport[i]; }} 这篇关于向Crystal report viewer添加多个报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-09 19:52