我有一个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)
我该如何解决这个问题..非常感谢你
答案 0 :(得分:0)
不要缩放到55%,而是尝试使用值1来适应页面的宽度,或者使用2来适应页面(来自MSDN)。
答案 1 :(得分:0)
我可以通过设置窗口的高度和宽度属性来设置像素值来完成调整大小。
即
CrystalReportViewer.Width = 1100
CrystalReportViewer.Height = 1200
需要一些游戏来让你的价值观正确但这很有效,我没有任何缩放问题。