public static void ShowRDLC(string name, Stream stream, Dictionary<string, object> reportDataSource, Action<ReportViewDialog> action, PrintEventHandler printHandler) { using (ReportViewDialog dialog = new ReportViewDialog()) { dialog.LoadReportDefinition(stream); dialog.Text = name; foreach (KeyValuePair<string, object> pair in reportDataSource) { dialog.AddDataSource(pair.Key, pair.Value); if (LoggingService.IsDebugEnabled) { LoggingService.DebugFormatted("添加报表数据源:{0}", new object[] { pair.Key }); } } if (LoggingService.IsDebugEnabled) { LoggingService.Debug("执行自定义报表处理过程"); } if (action != null) { action(dialog); } dialog.WindowState = FormWindowState.Maximized; if (printHandler != null) { dialog.Print += printHandler; } dialog.ShowDialog(); try { dialog.Close(); } catch { } } }
protected virtual void CustomReportViewDialog(ReportViewDialog rptDlg) { }