Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 //
// Printing the DataGridView Control
// in response to a toolbar button press – the myprintsettings and mypagesettings objects are objects used by the local
// program to save printer and page settings
//
private void printToolStripButton_Click(object sender, EventArgs e)
{
DGVPrinter printer = new DGVPrinter();
printer.Title = "DataGridView Report";
printer.SubTitle = "An Easy to Use DataGridView Printing Object";
printer.SubTitleFormatFlags = StringFormatFlags.LineLimit |
StringFormatFlags.NoClip;
printer.PageNumbers = true;
printer.PageNumberInHeader = false;
printer.PorportionalColumns = true;
printer.HeaderCellAlignment = StringAlignment.Near;
printer.Footer = "Your Company Name Here";
printer.FooterSpacing = 15;
// use saved settings
if (null != myprintsettings)
printer.PrintDocument.PrinterSettings = myprintsettings;
if (null != mypagesettings)
printer.PrintDocument.DefaultPageSettings = mypagesettings;
if (DialogResult.OK == printer.DisplayPrintDialog()) // replace DisplayPrintDialog() with your own print dialog
{
// save users' settings
myprintsettings = printer.PrinterSettings;
mypagesettings = printer.PageSettings;
// print without displaying the printdialog
printer.PrintNoDisplay(datagridviewControl);
}

////////////////////////////////////////

Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 //
// Printing the DataGridView Control
// in response to a toolbar button press
//
private void printToolStripButton_Click(object sender, EventArgs e)
{
DGVPrinter printer = new DGVPrinter();
printer.Title = "DataGridView Report";
printer.SubTitle = "An Easy to Use DataGridView Printing Object";
printer.SubTitleFormatFlags = StringFormatFlags.LineLimit |
StringFormatFlags.NoClip;
printer.PageNumbers = true;
printer.PageNumberInHeader = false;
printer.PorportionalColumns = true;
printer.HeaderCellAlignment = StringAlignment.Near;
printer.Footer = "Your Company Name Here";
printer.FooterSpacing = 15;
printer.PrintDataGridView(datagridviewControl);
}

C# DGVPrinter.cs 打印方法的更多相关文章

  1. DebugLog 打印方法执行时间

    DebugLog 打印方法执行时间 用于方便调试性能问题的打印插件.给访法加上@DebugLog,就能输出该方法的调用参数,以及执行时间. Project gradle配置 // Top-level ...

  2. 转网页WB.ExecWB控件打印方法

    网页WB.ExecWB控件打印方法 2010-02-01 12:48 代码: <table width="100%" cellpadding="1" on ...

  3. atitit. js 跨界面 页面 web cs 传值方法总结

    atitit. js 跨界面 页面 web cs 传值方法总结 #--需求 js #---两个方法:   直接传跟跟间接传递... 1.直接传跟new form(param)    web使用url方 ...

  4. js打印方法总结

    前段时间做web项目用到了页面打印,在网上找了些资料,自己也试了很多方法,将这些方案列出下: 1.window.print()方法打印,所有主要浏览器都支持 print() 方法 这个方法很实用,只需 ...

  5. 实现Square类,让其继承自Rectangle类,并在Square类增添新属性和方法,在2的基础上,在Square类中重写Rectangle类中的初始化和打印方法

    实现Square类,让其继承自Rectangle类,并在Square类增添新属性和方法,在2的基础上,在Square类中重写Rectangle类中的初始化和打印方法 #import <Found ...

  6. Swift中自定义Log打印方法

    系统如何调用super方法 系统默认只会在构造函数中,自动调用super.init()方法,而且是在所写方法的尾部进行调用. 在其他函数中,如何需要调用父类的默认实现,都需要手动去实现. 如果在构造函 ...

  7. ASHX呼叫ASPX.cs的方法

    ASHX呼叫ASPX.cs的方法 问题来自论坛,有网友这样的要求,在ASHX内呼叫ASPX.cs的一个方法或函数. 在一个网站中,也许不止只有一个aspx网页.把aspx.cs内的方法宣告为publi ...

  8. Swift中自定义打印方法

    // 1.获取打印所在的文件 let file = ( #file as NSString).lastPathComponent // 2.获取打印所在的方法 let funcName = #func ...

  9. ASCX呼叫ASPX.CS的方法

    为了安全设计,一般情况之下,改用为接口(interface). 在网页中实现这个接口: 用户控件: 当然,把用户控件ascx拉至网页之后,在用户控件的linkbutton的click事件,就可以呼叫至 ...

随机推荐

  1. 简化版的AXI-LITE4和配合使用的RTL

    ////////////////////////////////////////////////////////////////////////////////// // // The ZYNQ FI ...

  2. 基于多进程的Tcp套接字服务器

    服务端 import socketfrom multiprocessing import Process def task(c): print('顾客吃点啥') while True: data = ...

  3. XSS-HTML&javaSkcript&CSS&jQuery&ajax

    1.设置不同的样式列表 <style> ul.a{list-style-tyrp:circle;}    ul.b{list-style-type:square;}   ul.c{list ...

  4. Brup Suite 渗透测试笔记(八)

    续上次笔记 1.之前记到payload类型的用户名生成器,(username  generator).这种类型发payload只要用于用户名和email账号的自动生成. 2.ECB加密块洗牌(ECB ...

  5. 实现本地svn目录同步时,服务器的相应目录保持自动同步

    提交一个TEST文件夹 但是服务器上并没有显示 而新检出的目录却有 这个时候需要手动去update才会显示,而不可能每次都去update,所以,就用到配置自动更新 1.创建svn目录:mkdir /v ...

  6. rsync启动并生成PID

    /usr/bin/rsync --daemon --config=/usr/local/rsync/etc/rsyncd.conf

  7. 论文阅读笔记五:U-Net: Convolutional Networks for Biomedical Image Segmentation(CVPR2015)

    前面介绍了两个文本检测的网络,分别为RRCNN和CTPN,接下来鄙人会介绍语义分割的一些经典网络,同样也是论文+代码实现的过程,这里记录一下自己学到的东西,首先从论文下手吧. 英文论文原文地址:htt ...

  8. python 装饰器(1)

    # 装饰器,对一个函数打扮 # def foo():# print("foo")# foo# foo()# def test1():# print('-----1-----')# ...

  9. Go中的panic和recover

    这两个内置函数,用来处理go的运行时错误. panic用来主动抛出错误, recover用来捕获panic抛出的错误. recover()和defer一起使用, 但是recover()只有在defer ...

  10. 安装和强行卸载fuse

    先卸载 yum list fuse yum --setopt=tsflags=noscripts remove fuse.x86_64 安装 yum install automake gcc-c++ ...