private void button2_Click(object sender, System.EventArgs e) { string reportName = listBox1.SelectedItem as string; if (reportName != null) { _c1r.Load(_fileName, reportName); Cursor = Cursors.WaitCursor; ShowData(_c1r.DataSource.ConnectionString, _c1r.DataSource.GetRecordSource(true), _c1r.DataSource.Filter); Cursor = null; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { C1.C1Report.C1Report c1r = new C1.C1Report.C1Report(); // load report definition c1r.Load(@"..\..\report.xml", "Alphabetical List of Products Report"); CorrectConnectionString(c1r); // define custom paper size, 20" x 60" PaperSize cps = new PaperSize("MyCustomSize", 2000, 6000); // assign custom paper size to report c1r.Document.DefaultPageSettings.PaperSize = cps; c1r.Render(); // c1DocumentViewer1.Document = c1r.C1Document.FixedDocumentSequence; }
void button_Click(object sender, EventArgs e) { var buttonSelected = sender as Button; if (buttonSelected == null) { return; } foreach (var button in _buttons) { button.BackColor = SystemColors.Control; } buttonSelected.BackColor = SystemColors.ControlDark; _ppv.Document = null; _ppv.PreviewPane.StatusText = "Generating report, this could take a few minutes..."; Cursor = Cursors.WaitCursor; Application.DoEvents(); try { var report = new C1.C1Report.C1Report(); var reportName = buttonSelected.Text; report.Load(ReportFile, reportName); CorrectConnectionString(report); RenderReport(report); } catch (Exception ex) { MessageBox.Show(this, "Error loading or rendering the report:\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { _ppv.PreviewPane.StatusText = "Ready"; Cursor = Cursors.Default; } }
void button_Click(object sender, RoutedEventArgs e) { var buttonSelected = sender as Button; if (buttonSelected == null) { return; } foreach (var button in _buttons) { button.Background = SystemColors.ControlBrush; } buttonSelected.Background = SystemColors.ControlDarkBrush; c1DocumentViewer1.Document = null; labelStatus.Content = "Generating report, this could take a few minutes..."; Cursor = Cursors.Wait; try { var report = new C1.C1Report.C1Report(); var reportName = buttonSelected.Content.ToString(); report.Load(ReportFile, reportName); CorrectConnectionString(report); c1DocumentViewer1.Document = report.C1Document.FixedDocumentSequence; } catch (Exception ex) { MessageBox.Show(this, "Error loading or rendering the report:\n" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } finally { labelStatus.Content = "Ready"; Cursor = Cursors.Arrow; } }