frmViewer.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:3k
源码类别:

医药行业

开发平台:

Visual Basic

  1. Public Class frmViewer
  2.     Inherits System.Windows.Forms.Form
  3. #Region " Windows Form Designer generated code "
  4.     Public Sub New()
  5.         MyBase.New()
  6.         'This call is required by the Windows Form Designer.
  7.         InitializeComponent()
  8.         'Add any initialization after the InitializeComponent() call
  9.     End Sub
  10.     'Form overrides dispose to clean up the component list.
  11.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  12.         If disposing Then
  13.             If Not (components Is Nothing) Then
  14.                 components.Dispose()
  15.             End If
  16.         End If
  17.         MyBase.Dispose(disposing)
  18.     End Sub
  19.     'Required by the Windows Form Designer
  20.     Private components As System.ComponentModel.IContainer
  21.     'NOTE: The following procedure is required by the Windows Form Designer
  22.     'It can be modified using the Windows Form Designer.  
  23.     'Do not modify it using the code editor.
  24.     Friend WithEvents Viewer1 As DataDynamics.ActiveReports.Viewer.Viewer
  25.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  26.         Me.Viewer1 = New DataDynamics.ActiveReports.Viewer.Viewer
  27.         Me.SuspendLayout()
  28.         '
  29.         'Viewer1
  30.         '
  31.         Me.Viewer1.BackColor = System.Drawing.SystemColors.Control
  32.         Me.Viewer1.Dock = System.Windows.Forms.DockStyle.Fill
  33.         Me.Viewer1.Location = New System.Drawing.Point(0, 0)
  34.         Me.Viewer1.Name = "Viewer1"
  35.         Me.Viewer1.ReportViewer.CurrentPage = 0
  36.         Me.Viewer1.ReportViewer.MultiplePageCols = 3
  37.         Me.Viewer1.ReportViewer.MultiplePageRows = 2
  38.         Me.Viewer1.Size = New System.Drawing.Size(985, 739)
  39.         Me.Viewer1.TabIndex = 0
  40.         Me.Viewer1.TableOfContents.Text = "Contents"
  41.         Me.Viewer1.TableOfContents.Width = 320
  42.         Me.Viewer1.Toolbar.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
  43.         '
  44.         'frmViewer
  45.         '
  46.         Me.AutoScaleBaseSize = New System.Drawing.Size(8, 18)
  47.         Me.ClientSize = New System.Drawing.Size(985, 739)
  48.         Me.Controls.Add(Me.Viewer1)
  49.         Me.Name = "frmViewer"
  50.         Me.Text = "Print Preview"
  51.         Me.ResumeLayout(False)
  52.     End Sub
  53. #End Region
  54.     Dim m_rpt As New DataDynamics.ActiveReports.ActiveReport()
  55.     Public Sub SetReport(ByRef report As DataDynamics.ActiveReports.ActiveReport)
  56.         Try
  57.             m_rpt = report
  58.         Catch ex As Exception
  59.             MessageBox.Show("Error: " + ex.Message + "n" + "Stack:n" + ex.StackTrace + "n" + ex.Source)
  60.         End Try
  61.     End Sub
  62.     Private Sub frmViewer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  63.         If m_rpt Is Nothing = False Then
  64.             Me.showReport(m_rpt)
  65.         End If
  66.     End Sub
  67.     Private Sub showReport(ByRef reportObject As DataDynamics.ActiveReports.ActiveReport)
  68.         Try
  69.             Dim rpt As New DataDynamics.ActiveReports.ActiveReport()
  70.             rpt = reportObject
  71.             rpt.Run()
  72.             Me.Viewer1().Document = rpt.Document
  73.         Catch ex As Exception
  74.             MessageBox.Show("Error:n " + ex.Message + "nStack:n" + ex.StackTrace + "nSource:n" + ex.Source)
  75.         End Try
  76.     End Sub
  77. End Class