zoukankan      html  css  js  c++  java
  • DataGridView打印类

    /Files/zhuqil/DGVPrinter.zip

     作者:http://www.codeproject.com/KB/printing/DGVPrinter.aspx

    【简单用法】:

     1 //
     2 // Printing the DataGridView Control
     3 // in response to a toolbar button press
     4 //
     5 private void printToolStripButton_Click(object sender, EventArgs e)
     6 {
     7 DGVPrinter printer = new DGVPrinter();
     8 printer.Title = "DataGridView Report";
     9 printer.SubTitle = "An Easy to Use DataGridView Printing Object";
    10 printer.SubTitleFormatFlags = StringFormatFlags.LineLimit |
    11 StringFormatFlags.NoClip;
    12 printer.PageNumbers = true;
    13 printer.PageNumberInHeader = false;
    14 printer.PorportionalColumns = true;
    15 printer.HeaderCellAlignment = StringAlignment.Near;
    16 printer.Footer = "Your Company Name Here";
    17 printer.FooterSpacing = 15;
    18 printer.PrintDataGridView(datagridviewControl);
    19 }

    【复杂用法】:

     1 //
     2 // Printing the DataGridView Control
     3 // in response to a toolbar button press – the myprintsettings and mypagesettings objects are objects used by the local
     4 // program to save printer and page settings
     5 //
     6 private void printToolStripButton_Click(object sender, EventArgs e)
     7 {
     8 DGVPrinter printer = new DGVPrinter();
     9 printer.Title = "DataGridView Report";
    10 printer.SubTitle = "An Easy to Use DataGridView Printing Object";
    11 printer.SubTitleFormatFlags = StringFormatFlags.LineLimit |
    12 StringFormatFlags.NoClip;
    13 printer.PageNumbers = true;
    14 printer.PageNumberInHeader = false;
    15 printer.PorportionalColumns = true;
    16 printer.HeaderCellAlignment = StringAlignment.Near;
    17 printer.Footer = "Your Company Name Here";
    18 printer.FooterSpacing = 15;
    19 // use saved settings
    20 if (null != myprintsettings)
    21 printer.PrintDocument.PrinterSettings = myprintsettings;
    22 if (null != mypagesettings)
    23 printer.PrintDocument.DefaultPageSettings = mypagesettings;
    24 if (DialogResult.OK == printer.DisplayPrintDialog()) // replace DisplayPrintDialog() with your own print dialog
    25 {
    26 // save users' settings
    27 myprintsettings = printer.PrinterSettings;
    28 mypagesettings = printer.PageSettings;
    29 // print without displaying the printdialog
    30 printer.PrintNoDisplay(datagridviewControl);
    31 }



    (全文完)


    以下为广告部分

    您部署的HTTPS网站安全吗?

    如果您想看下您的网站HTTPS部署的是否安全,花1分钟时间来 myssl.com 检测以下吧。让您的HTTPS网站变得更安全!

    SSL检测评估

    快速了解HTTPS网站安全情况。

    安全评级(A+、A、A-...)、行业合规检测、证书信息查看、证书链信息以及补完、服务器套件信息、证书兼容性检测等。

    SSL证书工具

    安装部署SSL证书变得更方便。

    SSL证书内容查看、SSL证书格式转换、CSR在线生成、SSL私钥加解密、CAA检测等。

    SSL漏洞检测

    让服务器远离SSL证书漏洞侵扰

    TLS ROBOT漏洞检测、心血漏洞检测、FREAK Attack漏洞检测、SSL Poodle漏洞检测、CCS注入漏洞检测。

  • 相关阅读:
    头像切换封装
    JSON数据的序列化方法
    HTML5 LocalStorage 本地存储
    onhashchange实现下一页与上一页功能,并且实现当前页面刷新时停留在当前页面
    提交页面可输入的数据-----XSS漏洞
    js冒泡排序
    html实现将网页页面分享到微信朋友圈添加缩略图图片的方法
    js常用正则表达式
    C 传递指针给函数
    C 指向指针的指针
  • 原文地址:https://www.cnblogs.com/zhuqil/p/1689225.html
Copyright © 2011-2022 走看看