2011-05-04 152 views

回答

0

它可以通過窗口類來完成:

見下面的代碼演示

MyWindowType myReport = new MyWindowType(); // create a window, MyWindow is an User Control of type Window, that is it extends Window 

MyCrystalReport myReport = new MyCrystalReport(); 
// Do necessary modifications to myReport such as Add Data and Send Parameters 
CrystalReportViewer rptViewer = new CrystalReportViewer(); // Construct a ReportViewer 
WindowsFormsHost host = new WindowsFormsHost(); // Create a WindowsFormsHost 
rptViewer.ReportSource = myReport; // Add Report to ReportSource 
host.Child = rptViewer; // Add report viewer as child to host 
myReport.reportGrid.Children.Add(host); // Add host to MainWindow, that is myReport in this example 
myReport.BringIntoView(); 
myReport.Show(); 
0

您使用的是什麼版本的Visual Studio?如果VS2010,有一個WPF CrystalReportViewer可供下載。

+0

我使用Visual Studio 2008。 –

相關問題