作者: qiaoke_song
查看: 227|回复: 3

[源码] 【报表工具】EzReport Build 1.0 (DLL源码 征询建议后补全)

[复制链接]
qiaoke_song 发表于 2018-11-22 21:46:02 | 显示全部楼层 |阅读模式
查看: 227|回复: 3
说明:
在征询建议的基础上进行了补全修改,正式写为DLL,可以完成基本的报表定制、打印功能。在程序设计中,很多时候报表不需要那么庞杂的功能,一些小程序的数据库报表只需要简单处理,就没必要安装FastReport、Crystal ReportsDevExpress等庞大组件了。
此程序代码可优化、功能可添加,自行完善修改。
1、调用方式:将EzReport_Build.dll添加到引用中,将fontawesome-webfont.ttf字库文件放置在一起
private void button1_Click(object sender, EventArgs e)
{

   Form_Desing.Initialize_Design();
}
即可,也可将Preview.cs、Form_Desing.cs中的private PanelEx修改为publicPanelEx,在你的Form中直接嵌入调用,比如打印、预览比例等函数有些已设置为public,也可将需要的函数和组件设为public直接调用。
数据库定义在:Define_DataLink.cs
绘制定义在:Draw_Function.cs
报表组件、界面颜色等定义在:Define_Global.cs
界面等其他附属在ui文件夹
2、 打印模式
设置dpi为96,SetResolution(96,96);
相对应dpi
打印纸张类型:
public static string[] page_types = new string[24] {
            "A0","A1","A2","A3","A4","A5","A6","A7",
            "B0","B1","B2","B3","B4","B5","B6","B7",
            "C0","C1","C2","C3","C4","C5","C6","C7"
       };
以及自定义纸张(单位设置为毫米)换算公式为:
(int)Math.Floor(int.Parse(input_def[0].textBox.Text) * 3.779527559055118)

相对应纸张大小(毫米)
public static string[] page_size = new string[24] {
"841×1189","594×841","420×594","297×420","210×297","148×210","105×148","74×105",
"1000×1414","707×1000","500×707","353×500","250×353","176×250","125×176","88×125",
"917×1297","648×917","458×648","324×458","229×324","162×229","114×162","81×114"
       };
对应像素为:
public static string[] page_pixel = new string[24] {
"3178×4493","2245×3178","1587×2245","1122×1587","793×1122","559×793","396×559","279×396",
"3779×5344","2672×3779","1889×2672","1334×1889","944×1334","665×944","472×665","332×472",
"3465×4902","2449×3465","1731×2449","1235×1731","865×1224","612×865","430×612","306×430"
       };
3、快捷键
Ctrl+上、下、左、右可移动组件
Shift+上、下、左、右调整组件大小
Alt+V 粘贴、Alt+C复制、等,在报表组件上点击右键,菜单中可看见或在报表栏目空白处点击右键。
4、 其余可参见代码中public函数,
其他说明可参见草稿:http://bbs.cskin.net/thread-14356-1-1.html
如有疏漏自行修正。

效果图:

【报表工具】EzReport Build 1.0 (DLL源码 征询建议后补全)

【报表工具】EzReport Build 1.0 (DLL源码 征询建议后补全)

案例源码下载:
EzReport_Build.rar (689 KB, 下载次数: 33)
回复 论坛版权

使用道具 举报

 楼主| qiaoke_song 发表于 2018-11-23 08:27:00 | 显示全部楼层
实在抱歉,源码有一点误差:
Report_Function.cs 的print_File ()函数内修改为:
if (_pgselect != -1)
        {
            pSize = new PaperSize(page_types[_pgselect] + " page", (int)(PreViewPage_Area.Width / 25.4f * 100f), (int)(PreViewPage_Area.Height / 25.4f * 100f));
..........................

   }
        else
        {
            ..............................
            pSize = new PaperSize("Custom page", (int)(PreViewPage_Area.Width / 25.4f * 100f), (int)(PreViewPage_Area.Height / 25.4f * 100f));
        }

换算比例搞成旧的了,横向打印输出打印机打不全了
cd37ycs 发表于 2018-11-24 10:14:18 | 显示全部楼层
感谢分享。谢谢付出。
egala 发表于 2018-11-29 13:49:49 | 显示全部楼层
谢谢分享·谢谢楼主,
您需要登录后才可以回帖 登录 | 加入CSkin论坛

本版积分规则

QQ|申请友链|小黑屋|手机版|Archiver|CSkin ( 粤ICP备13070794号

Powered by Discuz! X3.2  © 2001-2013 Comsenz Inc.  Designed by ARTERY.cn
GMT+8, 2018-12-14 21:19, Processed in 0.830430 second(s), 35 queries , Gzip On.

快速回复 返回顶部 返回列表