frmViewer.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:3k
- Public Class frmViewer
- Inherits System.Windows.Forms.Form
- #Region " Windows Form Designer generated code "
- Public Sub New()
- MyBase.New()
- 'This call is required by the Windows Form Designer.
- InitializeComponent()
- 'Add any initialization after the InitializeComponent() call
- End Sub
- 'Form overrides dispose to clean up the component list.
- Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
- If disposing Then
- If Not (components Is Nothing) Then
- components.Dispose()
- End If
- End If
- MyBase.Dispose(disposing)
- End Sub
- 'Required by the Windows Form Designer
- Private components As System.ComponentModel.IContainer
- 'NOTE: The following procedure is required by the Windows Form Designer
- 'It can be modified using the Windows Form Designer.
- 'Do not modify it using the code editor.
- Friend WithEvents Viewer1 As DataDynamics.ActiveReports.Viewer.Viewer
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Me.Viewer1 = New DataDynamics.ActiveReports.Viewer.Viewer
- Me.SuspendLayout()
- '
- 'Viewer1
- '
- Me.Viewer1.BackColor = System.Drawing.SystemColors.Control
- Me.Viewer1.Dock = System.Windows.Forms.DockStyle.Fill
- Me.Viewer1.Location = New System.Drawing.Point(0, 0)
- Me.Viewer1.Name = "Viewer1"
- Me.Viewer1.ReportViewer.CurrentPage = 0
- Me.Viewer1.ReportViewer.MultiplePageCols = 3
- Me.Viewer1.ReportViewer.MultiplePageRows = 2
- Me.Viewer1.Size = New System.Drawing.Size(985, 739)
- Me.Viewer1.TabIndex = 0
- Me.Viewer1.TableOfContents.Text = "Contents"
- Me.Viewer1.TableOfContents.Width = 320
- Me.Viewer1.Toolbar.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- '
- 'frmViewer
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(8, 18)
- Me.ClientSize = New System.Drawing.Size(985, 739)
- Me.Controls.Add(Me.Viewer1)
- Me.Name = "frmViewer"
- Me.Text = "Print Preview"
- Me.ResumeLayout(False)
- End Sub
- #End Region
- Dim m_rpt As New DataDynamics.ActiveReports.ActiveReport()
- Public Sub SetReport(ByRef report As DataDynamics.ActiveReports.ActiveReport)
- Try
- m_rpt = report
- Catch ex As Exception
- MessageBox.Show("Error: " + ex.Message + "n" + "Stack:n" + ex.StackTrace + "n" + ex.Source)
- End Try
- End Sub
- Private Sub frmViewer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- If m_rpt Is Nothing = False Then
- Me.showReport(m_rpt)
- End If
- End Sub
- Private Sub showReport(ByRef reportObject As DataDynamics.ActiveReports.ActiveReport)
- Try
- Dim rpt As New DataDynamics.ActiveReports.ActiveReport()
- rpt = reportObject
- rpt.Run()
- Me.Viewer1().Document = rpt.Document
- Catch ex As Exception
- MessageBox.Show("Error:n " + ex.Message + "nStack:n" + ex.StackTrace + "nSource:n" + ex.Source)
- End Try
- End Sub
- End Class