首页 新闻 会员 周边

winform中DataGridView打印问题

0
悬赏园豆:100 [已解决问题] 解决于 2009-02-09 16:04

vs2005(c#),datagridview如有3条(行)记录,每一行显示在一页报表中。
使用FastReport报表工具,如有其它报表工具实现也可以。谢谢
先给100分,能解决再加多少都行。

kaka9的主页 kaka9 | 初学一级 | 园豆:100
提问于:2009-02-07 17:20
< >
分享
最佳答案
0

兄弟我为了你这个问题我研究了一个上午啊,哈哈不过我现在研究出来了,你先下载http://www.codeproject.com/KB/printing/datagridviewprinter.aspx

里面的demo和源码,你直接运行demo即可,这个东东和我们公司的颇为相似,因此我小小改动即可满足你的每页显示一行的特别要求啦,现在按我说的去做,打开DataGridViewPrinterApplication文件夹里面的项目工程DataGridViewPrinterApplication.sln,查看DataGridViewPrinter.cs,找到DataGridViewPrinter的382-388行,然后注释掉,替换为 CurrentRow++; return true;两句代码

具体是  // Checking if the CurrentY is exceeds the page boundries
                // If so then exit the function and returning true meaning another PagePrint action is required
                //if ((int)CurrentY > (PageHeight - TopMargin - BottomMargin))
                //{
                //    CurrentRow++;
                //    return true;
                //}

                CurrentRow++;
                return true;

这样你点击打印预览就会发现每页打一行!    

张蒙蒙 | 菜鸟二级 |园豆:405 | 2009-02-09 10:17
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册