• 大小: 0.67M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2020-12-26
  • 语言: C#
  • 标签: UI  源码  d  1  t  

资源简介

在征询建议的基础上进行了补全修改,正式写为DLL,可以完成基本的报表定制、打印功能。在程序设计中,很多时候报表不需要那么庞杂的功能,一些小程序的数据库报表只需要简单处理,就没必要安装FastReportCrystal ReportsDevExpress等庞大组件了。由于为前面征询意见的补全,所以不需分数。

此程序代码可优化、功能可添加,自行完善修改。

1、调用方式:将EzReport_Build.dll添加到引用中,将fontawesome-webfont.ttf字库文件放置在一起

private void button1_Click(object sender, EventArgs e)

{

    Form_Desing.Initialize_Design();

}

即可,也可将Preview.csForm_Desing.cs中的private PanelEx修改为public PanelEx,在你的Form中直接嵌入调用,比如打印、预览比例等函数有些已设置为public,也可将需要的函数和组件设为public直接调用。

数据库定义在:Define_DataLink.cs

绘制定义在:Draw_Function.cs

报表组件、界面颜色等定义在:Define_Global.cs

界面等其他附属在ui文件夹

2、 打印模式

设置dpi96SetResolution(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));
         }

换算比例搞成旧的了,横向打印输出打印机打不全了。自己修改下

资源截图

代码片段和文件信息

/*---------------------------------------------
整理自用 EzReport Build 报表组件
适用版本:.Net 2.0 - .Net 4.6 (32、64位)
设计:Song Qiao Ke  
          Email: Qiaoke_Song@163.com
          QQ:2452243110
最后更新:2018.11
-----------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;

public static class Define_Datalink
{
    /// 
    /// 数据库连接
    /// 

    public static SqlConnection SQLSERVER_Conn; // sql 连接
    public static OleDbConnection ACCESS_Conn; // access 连接

    public static SqlDataAdapter Sql_Cont;
    public static OleDbDataAdapter Access_Cont;

    public static SqlCommand SqlCom;
    public static OleDbCommand AccessCom;

    public static Dat

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.     60928  2018-11-22 21:15  EzReport_Build\.vs\EzReport_Build\v15\.suo

     文件          0  2018-11-22 19:53  EzReport_Build\.vs\EzReport_Build\v15\Server\sqlite3\db.lock

     文件     786432  2018-11-22 20:59  EzReport_Build\.vs\EzReport_Build\v15\Server\sqlite3\storage.ide

     文件      32768  2018-11-22 21:11  EzReport_Build\.vs\EzReport_Build\v15\Server\sqlite3\storage.ide-shm

     文件     119512  2018-11-22 21:15  EzReport_Build\.vs\EzReport_Build\v15\Server\sqlite3\storage.ide-wal

     文件     226304  2018-11-22 20:24  EzReport_Build\EzReport_Build\bin\Debug\EzReport_Build.dll

     文件     374272  2018-11-22 20:24  EzReport_Build\EzReport_Build\bin\Debug\EzReport_Build.pdb

     文件     165548  2017-11-04 19:24  EzReport_Build\EzReport_Build\bin\Debug\fontawesome-webfont.ttf

     文件      10805  2018-11-22 18:36  EzReport_Build\EzReport_Build\Define_Datalink.cs

     文件      36175  2018-11-22 20:18  EzReport_Build\EzReport_Build\Define_Global.cs

     文件      14167  2018-11-22 20:18  EzReport_Build\EzReport_Build\Draw_Function.cs

     文件      10619  2018-11-22 20:14  EzReport_Build\EzReport_Build\EzReport_Build.csproj

     文件      32490  2018-11-22 20:18  EzReport_Build\EzReport_Build\EzResource.Designer.cs

     文件      58967  2018-11-22 20:14  EzReport_Build\EzReport_Build\EzResource.resx

     文件      32505  2018-11-22 20:14  EzReport_Build\EzReport_Build\EzResource1.Designer.cs

     文件      84609  2018-11-22 20:23  EzReport_Build\EzReport_Build\Form_Desing.cs

     文件      37688  2018-11-22 20:23  EzReport_Build\EzReport_Build\Info_Function.cs

     文件      21794  2018-11-22 20:15  EzReport_Build\EzReport_Build\Preview.cs

     文件       1317  2018-11-22 19:53  EzReport_Build\EzReport_Build\Properties\AssemblyInfo.cs

     文件      38863  2018-11-22 20:33  EzReport_Build\EzReport_Build\Report_Function.cs

     文件      15083  2018-11-06 08:52  EzReport_Build\EzReport_Build\Resources\a_bot.png

     文件      15120  2018-11-06 08:52  EzReport_Build\EzReport_Build\Resources\a_center.png

     文件      15081  2018-11-06 08:53  EzReport_Build\EzReport_Build\Resources\a_left.png

     文件      15076  2018-11-06 08:54  EzReport_Build\EzReport_Build\Resources\a_right.png

     文件      15080  2018-11-06 08:54  EzReport_Build\EzReport_Build\Resources\a_top.png

     文件        119  2018-10-31 12:19  EzReport_Build\EzReport_Build\Resources\background.png

     文件      15948  2018-11-06 10:40  EzReport_Build\EzReport_Build\Resources\band_move.png

     文件      15364  2018-11-04 12:45  EzReport_Build\EzReport_Build\Resources\band_pb.png

     文件      15481  2018-11-04 12:46  EzReport_Build\EzReport_Build\Resources\band_pd.png

     文件      15360  2018-11-04 12:46  EzReport_Build\EzReport_Build\Resources\band_pt.png

............此处省略116个文件信息

评论

共有 条评论