[英]reportviewer.LocalReport.GetTotalPages() returns sometimes 1 or 2
In my c# winforms application I'm using a user control, and added my report viewer and a custom toolbar. 在我的c# winforms应用程序中,我使用了一个用户控件,并添加了报表查看器和自定义工具栏。 I want to create a custom navigation for it as well.
我也想为其创建自定义导航。 But, for some reason when I want to check the total number of pages to decide whether or not to show the navigation buttons, it sometimes returns 1 or 2... I've ran out of ideas and not quite sure where to go from here..
但是,由于某些原因,当我想检查页面总数以决定是否显示导航按钮时,有时会返回1或2 ...我的想法已经用完了,不太确定从何而来这里..
code here 这里的代码
if (rvReports.LocalReport.GetTotalPages() > 1)
{
liFirst.Visible = true;
liPrevious.Visible = true;
liNext.Visible = true;
liLast.Visible = true;
}
The amount of pages can vary with the data in the report or even for the same data by the connected/selected printer. 页面的数量可能会随报告中的数据而变化,甚至对于所连接/所选打印机的相同数据而言也会变化。 If the page count is based on the Form, it might even vary by the size of the form or the resolution of the display.
如果页数基于表单,则它甚至可能因表单的大小或显示的分辨率而异。 If you wonder why it's sometimes 1 and sometimes 2, you should find out whats different, maybe even print the report for each case and look at it.
如果您想知道为什么有时是1,有时是2,则应该找出不同之处,甚至可以打印每种情况的报告并进行查看。 You won't get any results from looking at the page count number alone.
仅查看页数不会获得任何结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.