DataGridViewEx扩展之合计行

上传者: ireenter | 上传时间: 2022-08-30 16:26:46 | 文件大小: 279KB | 文件类型: RAR
*调整导出及打印的格式与显示一致;合计行,详细参见第10条修正功能,全部源码及示例。 * 文 件 名:DataGridViewEx.cs * 创 建 人:明振居士 * Email:nzj.163@163.com qq:342155124 * 创建时间:2010-06-01 * 最后修改时间:2012-1-19 增加第10条所示的功能;修改了列头超过26列的错误,导出excel为数组方式,速度更快,导出的单元格设置为文本格式。 * 标 题:用户自定义的DataGridView控件 * 功能描述:扩展DataGridView控件功能 * 扩展功能: * 1、搜索Search(); 有两个同明方法,参数不同 F3为快捷键继续向下搜索 * 2、用TreeView HeadSource 来设置复杂的标题样式,如果某个节点对应的显示列隐藏,请将该节点Tag设置为hide,隐藏列的排列位置与绑定数据元列位置对应,树叶节点的顺序需要与结果集的列顺序一致 * 3、通过反射导出Excel,无需引用com组件,方法ExportExcel() ,不受列数的限制,表头同样可以导出,AutoFit属性设置导出excel后是否自动调整单元格宽度 * 导出内容支持自定义的:Title List Header List Footer,支持在设计时值的设定,窗口关闭时Excel资源自动彻底释放 * 4、可以自己任意设定那些列显示及不显示,通过调用方法SetColumnVisible()实现。 * 5、设置列标题SetHeader(),设置列永远可见AlwaysShowCols(),设置列暂时不可见HideCols() * 注意,当使用了TreeView作为复杂Header时,不要使用本方法,Header显示的内容根据treeview内容而显示 * 6、列宽度及顺序的保存SaveGridView(),加载LoadGridView() * 7、支持所见即所得的打印功能,举例如下 * private void button5_Click(object sender, EventArgs e) { DGVPrinter printer = new DGVPrinter(); printer.PrintPreviewDataGridView(DataGridViewEx1); } * 8、自定义合并行与列,行合并用 MergeRowColumn 属性,列合并用MergeColumnNames属性,都可以定义多个列 * 9、行标号的设置 bool ShowRowNumber; * 10、增加最后一行的汇总行,支持列的聚合函数,参见http://msdn.microsoft.com/zh-cn/library/system.data.datacolumn.[removed]v=VS.100).aspx * 假设对id列显示“合计”字符,avgPrice进行平均值,total列显示合计,则对ComputeColumns增加三行内容:id,合计:;avgPrice,Avg(avgPrice);total,Sum(total) * 如果需要对值进行格式控制,请实现beforeShow事件 * 增加了导出和打印对应的支持,所见即所得的对齐方应用于式导出及打印。

文件下载

资源详情

[{"title":"( 49 个子文件 279KB ) DataGridViewEx扩展之合计行","children":[{"title":"DataGridViewExample","children":[{"title":"DataGridViewExample","children":[{"title":"Form1.Designer.cs <span style='color:#111;'> 13.97KB </span>","children":null,"spread":false},{"title":"Program.cs <span style='color:#111;'> 500B </span>","children":null,"spread":false},{"title":"app.config <span style='color:#111;'> 386B </span>","children":null,"spread":false},{"title":"obj","children":[{"title":"x86","children":[{"title":"Debug","children":[{"title":"DataGridViewExample.csproj.FileListAbsolute.txt <span style='color:#111;'> 1.26KB </span>","children":null,"spread":false},{"title":"Common.DataGridViewEx.InputBox.resources <span style='color:#111;'> 1.36KB </span>","children":null,"spread":false},{"title":"Common.DataGridViewEx.FrmColumnSet.resources <span style='color:#111;'> 180B </span>","children":null,"spread":false},{"title":"ResGen.write.1.tlog <span style='color:#111;'> 1.78KB </span>","children":null,"spread":false},{"title":"Common.DataGridViewEx.DataGridViewEx.resources <span style='color:#111;'> 180B </span>","children":null,"spread":false},{"title":"ResGen.read.1.tlog <span style='color:#111;'> 940B </span>","children":null,"spread":false},{"title":"DesignTimeResolveAssemblyReferencesInput.cache <span style='color:#111;'> 6.09KB </span>","children":null,"spread":false},{"title":"DataGridViewExample.Form1.resources <span style='color:#111;'> 3.03KB </span>","children":null,"spread":false},{"title":"DataGridViewExample.exe <span style='color:#111;'> 100.50KB </span>","children":null,"spread":false},{"title":"TempPE","children":[{"title":"Properties.Resources.Designer.cs.dll <span style='color:#111;'> 5.00KB </span>","children":null,"spread":false}],"spread":false},{"title":"DataGridViewExample.pdb <span style='color:#111;'> 205.50KB </span>","children":null,"spread":false},{"title":"DataGridViewExample.Properties.Resources.resources <span style='color:#111;'> 180B </span>","children":null,"spread":false},{"title":"DesignTimeResolveAssemblyReferences.cache <span style='color:#111;'> 17.73KB </span>","children":null,"spread":false}],"spread":false}],"spread":true}],"spread":true},{"title":"bin","children":[{"title":"Debug","children":[{"title":"DataGridViewExample.exe.config <span style='color:#111;'> 386B </span>","children":null,"spread":false},{"title":"DataGridViewExample.vshost.exe.manifest <span style='color:#111;'> 490B </span>","children":null,"spread":false},{"title":"DataGridViewExample.vshost.exe.config <span style='color:#111;'> 386B </span>","children":null,"spread":false},{"title":"DataGridViewExample.exe <span style='color:#111;'> 100.50KB </span>","children":null,"spread":false},{"title":"DataGridViewExample.pdb <span style='color:#111;'> 205.50KB </span>","children":null,"spread":false},{"title":"test.mdb <span style='color:#111;'> 396.00KB </span>","children":null,"spread":false},{"title":"DataGridViewExample.vshost.exe <span style='color:#111;'> 11.34KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"Form1.cs <span style='color:#111;'> 6.97KB </span>","children":null,"spread":false},{"title":"Dal","children":[{"title":"db.cs <span style='color:#111;'> 1.19KB </span>","children":null,"spread":false}],"spread":true},{"title":"DataGridViewExample.csproj <span style='color:#111;'> 5.11KB </span>","children":null,"spread":false},{"title":"Form1.resx <span style='color:#111;'> 10.09KB </span>","children":null,"spread":false},{"title":"Settings.cs <span style='color:#111;'> 1.21KB </span>","children":null,"spread":false},{"title":"DataGridViewEx","children":[{"title":"DataGridViewEx.cs <span style='color:#111;'> 99.22KB </span>","children":null,"spread":false},{"title":"InputBox.designer.cs <span style='color:#111;'> 5.20KB </span>","children":null,"spread":false},{"title":"FrmColumnSet.resx <span style='color:#111;'> 5.68KB </span>","children":null,"spread":false},{"title":"DGVPrinter.cs <span style='color:#111;'> 118.82KB </span>","children":null,"spread":false},{"title":"FrmColumnSet.cs <span style='color:#111;'> 2.52KB </span>","children":null,"spread":false},{"title":"InputBox.cs <span style='color:#111;'> 2.55KB </span>","children":null,"spread":false},{"title":"vssver2.scc <span style='color:#111;'> 447B </span>","children":null,"spread":false},{"title":"DataGridViewEx.resx <span style='color:#111;'> 5.85KB </span>","children":null,"spread":false},{"title":"FrmColumnSet.designer.cs <span style='color:#111;'> 5.25KB </span>","children":null,"spread":false},{"title":"InputBox.resx <span style='color:#111;'> 8.34KB </span>","children":null,"spread":false},{"title":"DataGridViewEx.Designer.cs <span style='color:#111;'> 1.67KB </span>","children":null,"spread":false}],"spread":false},{"title":"Bll","children":[{"title":"Class.cs <span style='color:#111;'> 405B </span>","children":null,"spread":false},{"title":"DataGridViewInfo.cs <span style='color:#111;'> 3.01KB </span>","children":null,"spread":false}],"spread":true},{"title":"Properties","children":[{"title":"AssemblyInfo.cs <span style='color:#111;'> 1.34KB </span>","children":null,"spread":false},{"title":"Settings.Designer.cs <span style='color:#111;'> 1.63KB </span>","children":null,"spread":false},{"title":"Resources.resx <span style='color:#111;'> 5.48KB </span>","children":null,"spread":false},{"title":"Settings.settings <span style='color:#111;'> 973B </span>","children":null,"spread":false},{"title":"Resources.Designer.cs <span style='color:#111;'> 2.81KB </span>","children":null,"spread":false}],"spread":true},{"title":"test.mdb <span style='color:#111;'> 396.00KB </span>","children":null,"spread":false}],"spread":false},{"title":"DataGridViewExample.suo <span style='color:#111;'> 33.00KB </span>","children":null,"spread":false},{"title":"DataGridViewExample.sln <span style='color:#111;'> 899B </span>","children":null,"spread":false}],"spread":true}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明