C#万能打印--winform中打印dataGridView表格

上传者: zjlovety | 上传时间: 2019-12-23 03:43:38 | 文件大小: 149KB | 文件类型: rar
1.vs2008,在解决方案中添加现有项目DLLFullPrint,然后在主工程中添加引用,引用这个项目。 2.在界面设计中,添加按钮PrintButton,双击它进入代码界面; 在代码文件中,首先使用using DLLFullPrint; 然后按钮点击事件中写入以下代码: private void printButton_Click(object sender, EventArgs e) { System.Data.DataTable dt = new System.Data.DataTable(); DataRow dr; //设置列表头 foreach (DataGridViewColumn headerCell in dataGridView1.Columns) { dt.Columns.Add(headerCell.HeaderText); } foreach (DataGridViewRow item in dataGridView1.Rows) { dr = dt.NewRow(); for (int i = 0; i < dt.Columns.Count; i++) { dr[i] = item.Cells[i].Value.ToString(); } dt.Rows.Add(dr); } DataSet dy= new DataSet(); dy.Tables.Add(dt); MyDLL.TakeOver(dy); } 3.运行程序,点击打印按钮,弹出打印界面,调节界面,打印预览,需安装打印机。

文件下载

资源详情

[{"title":"( 60 个子文件 149KB ) C#万能打印--winform中打印dataGridView表格","children":[{"title":"DLLFullPrint","children":[{"title":"DLLFullPrint.sln <span style='color:#111;'> 925B </span>","children":null,"spread":false},{"title":".svn","children":[{"title":"tmp","children":[{"title":"props","children":null,"spread":false},{"title":"prop-base","children":null,"spread":false},{"title":"text-base","children":null,"spread":false}],"spread":true},{"title":"props","children":null,"spread":false},{"title":"all-wcprops <span style='color:#111;'> 338B </span>","children":null,"spread":false},{"title":"entries <span style='color:#111;'> 548B </span>","children":null,"spread":false},{"title":"prop-base","children":[{"title":"DLLFullPrint.suo.svn-base <span style='color:#111;'> 53B </span>","children":null,"spread":false}],"spread":true},{"title":"text-base","children":[{"title":"DLLFullPrint.suo.svn-base <span style='color:#111;'> 15.00KB </span>","children":null,"spread":false},{"title":"DLLFullPrint.sln.svn-base <span style='color:#111;'> 925B </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"DLLFullPrint","children":[{"title":"DLLFullPrint.csproj <span style='color:#111;'> 2.65KB </span>","children":null,"spread":false},{"title":"Frm_PrintSet.cs <span style='color:#111;'> 17.33KB </span>","children":null,"spread":false},{"title":".svn","children":[{"title":"tmp","children":[{"title":"props","children":null,"spread":false},{"title":"prop-base","children":null,"spread":false},{"title":"text-base","children":null,"spread":false}],"spread":true},{"title":"props","children":null,"spread":false},{"title":"all-wcprops <span style='color:#111;'> 925B </span>","children":null,"spread":false},{"title":"entries <span style='color:#111;'> 1.16KB </span>","children":null,"spread":false},{"title":"prop-base","children":null,"spread":false},{"title":"text-base","children":[{"title":"DLLFullPrint.csproj.svn-base <span style='color:#111;'> 2.65KB </span>","children":null,"spread":false},{"title":"Frm_PrintSet.cs.svn-base <span style='color:#111;'> 17.33KB </span>","children":null,"spread":false},{"title":"MyDLL.cs.svn-base <span style='color:#111;'> 997B </span>","children":null,"spread":false},{"title":"PrintClass.cs.svn-base <span style='color:#111;'> 22.79KB </span>","children":null,"spread":false},{"title":"Frm_PrintSet.Designer.cs.svn-base <span style='color:#111;'> 37.92KB </span>","children":null,"spread":false},{"title":"Frm_PrintSet.resx.svn-base <span style='color:#111;'> 6.07KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"Frm_PrintSet.Designer.cs <span style='color:#111;'> 37.92KB </span>","children":null,"spread":false},{"title":"Properties","children":[{"title":".svn","children":[{"title":"tmp","children":[{"title":"props","children":null,"spread":false},{"title":"prop-base","children":null,"spread":false},{"title":"text-base","children":null,"spread":false}],"spread":true},{"title":"props","children":null,"spread":false},{"title":"all-wcprops <span style='color:#111;'> 260B </span>","children":null,"spread":false},{"title":"entries <span style='color:#111;'> 390B </span>","children":null,"spread":false},{"title":"prop-base","children":null,"spread":false},{"title":"text-base","children":[{"title":"AssemblyInfo.cs.svn-base <span style='color:#111;'> 1.29KB </span>","children":null,"spread":false}],"spread":false}],"spread":true},{"title":"AssemblyInfo.cs <span style='color:#111;'> 1.29KB </span>","children":null,"spread":false}],"spread":true},{"title":"Frm_PrintSet.resx <span style='color:#111;'> 6.07KB </span>","children":null,"spread":false},{"title":"obj","children":[{"title":"Debug","children":[{"title":"DLLFullPrint.Frm_PrintSet.resources <span style='color:#111;'> 180B </span>","children":null,"spread":false},{"title":"Refactor","children":[{"title":"DLLFullPrint.dll <span style='color:#111;'> 8.50KB </span>","children":null,"spread":false}],"spread":true},{"title":".svn","children":[{"title":"tmp","children":[{"title":"props","children":null,"spread":false},{"title":"prop-base","children":null,"spread":false},{"title":"text-base","children":null,"spread":false}],"spread":false},{"title":"props","children":null,"spread":false},{"title":"all-wcprops <span style='color:#111;'> 989B </span>","children":null,"spread":false},{"title":"entries <span style='color:#111;'> 1.10KB </span>","children":null,"spread":false},{"title":"prop-base","children":[{"title":"DLLFullPrint.pdb.svn-base <span style='color:#111;'> 53B </span>","children":null,"spread":false},{"title":"DLLFullPrint.dll.svn-base <span style='color:#111;'> 53B </span>","children":null,"spread":false},{"title":"DLLFullPrint.Frm_PrintSet.resources.svn-base <span style='color:#111;'> 53B </span>","children":null,"spread":false},{"title":"DLLFullPrint.csproj.GenerateResource.Cache.svn-base <span style='color:#111;'> 53B </span>","children":null,"spread":false}],"spread":false},{"title":"text-base","children":[{"title":"DLLFullPrint.pdb.svn-base <span style='color:#111;'> 49.50KB </span>","children":null,"spread":false},{"title":"DLLFullPrint.dll.svn-base <span style='color:#111;'> 32.00KB </span>","children":null,"spread":false},{"title":"DLLFullPrint.csproj.FileListAbsolute.txt.svn-base <span style='color:#111;'> 3.73KB </span>","children":null,"spread":false},{"title":"DLLFullPrint.Frm_PrintSet.resources.svn-base <span style='color:#111;'> 180B </span>","children":null,"spread":false},{"title":"DLLFullPrint.csproj.GenerateResource.Cache.svn-base <span style='color:#111;'> 781B </span>","children":null,"spread":false}],"spread":false}],"spread":false},{"title":"DLLFullPrint.csproj.FileListAbsolute.txt <span style='color:#111;'> 9.70KB </span>","children":null,"spread":false},{"title":"TempPE","children":[{"title":".svn","children":[{"title":"tmp","children":[{"title":"props","children":null,"spread":false},{"title":"prop-base","children":null,"spread":false},{"title":"text-base","children":null,"spread":false}],"spread":false},{"title":"props","children":null,"spread":false},{"title":"all-wcprops <span style='color:#111;'> 120B </span>","children":null,"spread":false},{"title":"entries <span style='color:#111;'> 244B </span>","children":null,"spread":false},{"title":"prop-base","children":null,"spread":false},{"title":"text-base","children":null,"spread":false}],"spread":false}],"spread":false},{"title":"DLLFullPrint.pdb <span style='color:#111;'> 47.50KB </span>","children":null,"spread":false},{"title":"DLLFullPrint.dll <span style='color:#111;'> 32.00KB </span>","children":null,"spread":false},{"title":"DLLFullPrint.csproj.GenerateResource.Cache <span style='color:#111;'> 781B </span>","children":null,"spread":false}],"spread":true},{"title":".svn","children":[{"title":"tmp","children":[{"title":"props","children":null,"spread":false},{"title":"prop-base","children":null,"spread":false},{"title":"text-base","children":null,"spread":false}],"spread":true},{"title":"props","children":null,"spread":false},{"title":"all-wcprops <span style='color:#111;'> 470B </span>","children":null,"spread":false},{"title":"entries <span style='color:#111;'> 588B </span>","children":null,"spread":false},{"title":"prop-base","children":null,"spread":false},{"title":"text-base","children":[{"title":"DLLFullPrint.csproj.FileList.txt.svn-base <span style='color:#111;'> 255B </span>","children":null,"spread":false},{"title":"DLLFullPrint.csproj.FileListAbsolute.txt.svn-base <span style='color:#111;'> 2.97KB </span>","children":null,"spread":false}],"spread":false}],"spread":true},{"title":"DLLFullPrint.csproj.FileListAbsolute.txt <span style='color:#111;'> 2.97KB </span>","children":null,"spread":false},{"title":"DLLFullPrint.csproj.FileList.txt <span style='color:#111;'> 255B </span>","children":null,"spread":false}],"spread":true},{"title":"PrintClass.cs <span style='color:#111;'> 22.79KB </span>","children":null,"spread":false},{"title":"bin","children":[{"title":"Debug","children":[{"title":".svn","children":[{"title":"tmp","children":[{"title":"props","children":null,"spread":false},{"title":"prop-base","children":null,"spread":false},{"title":"text-base","children":null,"spread":false}],"spread":false},{"title":"props","children":null,"spread":false},{"title":"all-wcprops <span style='color:#111;'> 407B </span>","children":null,"spread":false},{"title":"entries <span style='color:#111;'> 567B </span>","children":null,"spread":false},{"title":"prop-base","children":[{"title":"DLLFullPrint.pdb.svn-base <span style='color:#111;'> 53B </span>","children":null,"spread":false},{"title":"DLLFullPrint.dll.svn-base <span style='color:#111;'> 53B </span>","children":null,"spread":false}],"spread":false},{"title":"text-base","children":[{"title":"DLLFullPrint.pdb.svn-base <span style='color:#111;'> 49.50KB </span>","children":null,"spread":false},{"title":"DLLFullPrint.dll.svn-base <span style='color:#111;'> 32.00KB </span>","children":null,"spread":false}],"spread":false}],"spread":false},{"title":"DLLFullPrint.pdb <span style='color:#111;'> 47.50KB </span>","children":null,"spread":false},{"title":"DLLFullPrint.dll <span style='color:#111;'> 32.00KB </span>","children":null,"spread":false}],"spread":true},{"title":".svn","children":[{"title":"tmp","children":[{"title":"props","children":null,"spread":false},{"title":"prop-base","children":null,"spread":false},{"title":"text-base","children":null,"spread":false}],"spread":false},{"title":"props","children":null,"spread":false},{"title":"all-wcprops <span style='color:#111;'> 107B </span>","children":null,"spread":false},{"title":"entries <span style='color:#111;'> 243B </span>","children":null,"spread":false},{"title":"prop-base","children":null,"spread":false},{"title":"text-base","children":null,"spread":false}],"spread":false}],"spread":true},{"title":"MyDLL.cs <span style='color:#111;'> 997B </span>","children":null,"spread":false}],"spread":true},{"title":"DLLFullPrint.suo <span style='color:#111;'> 15.00KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}]

评论信息

  • allenyushuo :
    不能自定义 建议还是使用第三方的 例如grid++
    2017-11-27
  • never222 :
    不能自定义 建议还是使用第三方的 例如grid++
    2017-11-27
  • a229013811 :
    还可以吧,但是不能排版啊
    2017-11-01
  • a229013811 :
    还可以吧,但是不能排版啊
    2017-11-01
  • go2sleep :
    什么东西啊,骗分的吧
    2017-07-14
  • go2sleep :
    什么东西啊,骗分的吧
    2017-07-14
  • l_u__ :
    不错,功能可以
    2017-06-02
  • 昨夜冷风依旧 :
    不错,功能可以
    2017-06-02
  • wpf520hq :
    不错,自定义内容和排版不知道能不能实现
    2017-03-22
  • wpf520hq :
    不错,自定义内容和排版不知道能不能实现
    2017-03-22

免责申明

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