0

我有一个 vb.net 应用程序,其中包含您可以从中选择的报告列表。
当您选择一个报表时,它会加载数据并在 Crystal Report Viewer 中显示该报表。但是,报告显示太大了,调整它大小的唯一方法是还原屏幕,然后将其还原为全屏。滚动条仅在您向下和向上恢复页面后可见。

查看器的生成代码如下。

Me.CrystalReportViewer1.ActiveViewIndex = -1
    Me.CrystalReportViewer1.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange
    Me.CrystalReportViewer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.CrystalReportViewer1.Cursor = System.Windows.Forms.Cursors.Arrow
    Me.CrystalReportViewer1.DisplayBackgroundEdge = False
    Me.CrystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill
    Me.CrystalReportViewer1.EnableDrillDown = False
    Me.CrystalReportViewer1.Location = New System.Drawing.Point(230, 0)
    Me.CrystalReportViewer1.Name = "CrystalReportViewer1"
    Me.CrystalReportViewer1.SelectionFormula = ""
    Me.CrystalReportViewer1.ShowCloseButton = False
    Me.CrystalReportViewer1.ShowGroupTreeButton = False
    Me.CrystalReportViewer1.ShowRefreshButton = False
    Me.CrystalReportViewer1.ShowTextSearchButton = False
    Me.CrystalReportViewer1.Size = New System.Drawing.Size(517, 715)
    Me.CrystalReportViewer1.TabIndex = 1
    Me.CrystalReportViewer1.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None
    Me.CrystalReportViewer1.ViewTimeSelectionFormula = ""

我这样称呼它:

Dim rpt As String
    rpt = ListBox1.Items(ListBox1.SelectedIndex)
    If Not CrystalReportViewer1.ReportSource Is Nothing Then CrystalReportViewer1.ReportSource.dispose()

    Select Case rpt
        Case "Scoot"
            myreport = New graduation
            LoadDatabaseInfo(myreport)
            myreport.SetParameterValue("doop", indrno.Text)
            'myreport.SetParameterValue("dte", indate.Value)
            myreport.SetParameterValue("name", txb.Text)
            CrystalReportViewer1.ReportSource = myreport
            CrystalReportViewer1.Refresh()
            CrystalReportViewer1.Zoom(55)

我该如何解决这个..非常感谢

4

2 回答 2

0

与其缩放到 55%,不如尝试使用值 1 来适应页面宽度或使用 2 来适应页面(来自MSDN)。

于 2012-07-27T19:50:27.877 回答
0

我能够通过设置窗口的高度和宽度属性来设置像素值来满足我的调整大小需求。

IE

  CrystalReportViewer.Width = 1100
  CrystalReportViewer.Height = 1200

需要一些时间才能使您的值正确,但这很有效,而且我没有任何缩放问题。

于 2016-02-03T13:25:15.037 回答