资 源 简 介
在征询建议的基础上进行了补全修改,正式写为DLL,可以完成基本的报表定制、打印功能。在程序设计中,很多时候报表不需要那么庞杂的功能,一些小程序的数据库报表只需要简单处理,就没必要安装FastReport、Crystal Reports、DevExpress等庞大组件了。由于为前面征询意见的补全,所以不需分数。此程序代码可优化、功能可添加,自行完善修改。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修改为public PanelEx,在你的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" }; 按照ISO标准纸型、尺寸设置。打印支持选项: 3、快捷键Ctrl 上、下、左、右可移动组件Shift 上、下、左、右调整组件大小Alt V 粘贴、Alt C复制、等,在报表组件上点击右键,菜单中可看见或在报表栏目空白处点击右键。4、 其余可参见代码中public函数,其他说明可参见草稿:https://www.haolizi.net/example/view_16592.html征求意见稿:https://www.haolizi.net/example/view_16896.html如有疏漏自行修正。 实在抱歉,源码有一点误差: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)); }换算比例搞成旧的了,横向打印输出打印机打不全了。自己修改下