Crystal Report - 利用后台代码设计或实现水晶报表工具栏相关功能

水晶报表工具栏分页按钮响应事件:  

水晶报表中有自带的分页功能,在设置好每页显示的记录后会自动分页,并自动记录总页数和保存当前页,在工具栏可以通过“首页”“尾页”“下一页”“上一页”和“跳页”进行页面跳转。如果需要自定义分页按钮或需要调用分页实现的方法,可以调用以下的方法。

CrystalReportViewer1.ShowFirstPage();     //首页  
CrystalReportViewer1.ShowLastPage();      //末页  
CrystalReportViewer1.ShowNextPage();      //下一页  
CrystalReportViewer1.ShowPreviousPage();  //上一页  
CrystalReportViewer1.ShowNthPage(N);      //跳转到第 N 页
crystalReportViewer1.GetCurrentPageNumber().ToString();    //获取数据显示的当前页

 

设置水晶报表加载时,默认缩放比例:

在绑定水晶报表数据源crystalReportViewer1.ReportSource之后,设置水晶报表的Zoom属性为0或1或其他数值

crystalReportViewer1.Zoom(0); //页宽
crystalReportViewer1.Zoom(1); //整页
crystalReportViewer1.Zoom(400); //400%
//...以此类推
crystalReportViewer1.Zoom(25); //25%

如果在绑定数据源之前就设置Zoom属性,默认缩放比例可能无效

posted @ 2014-03-17 22:30  Tracine0513  阅读(564)  评论(0编辑  收藏  举报