DataGridView打印类
来源:互联网 发布:类似whatsapp的软件 编辑:程序博客网 时间:2024/06/10 02:40
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 }
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 }
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 }
0 0
- 一个dataGridview打印类
- DataGridView打印类
- 打印datagridview类
- Datagridview打印类
- DataGridView打印类
- DataGridView打印分页类
- DataGridView打印类
- 一个DATAGRIDVIEW的打印类
- 打印DataGridView内容的类
- DataGridView打印
- DataGridView打印
- DataGridView打印
- 打印dataGridView
- 多功能DataGridView打印类(WinForm C#)
- 打印DATAgridview所见即所得
- 实现DataGridView的打印
- DataGridView流水打印
- DataGridView的打印解决方案
- PAT (Basic Level) Practise (中文)1030. 完美数列(25)
- Mac Shell获取昨天日期
- Myeclipes8.0, 8.5 中安装SVN插件小结
- Opencv2相似图像检索
- jstree的简单使用例子
- DataGridView打印类
- java权限设置文件-java.policy
- Object-C 获取对象的属性和值
- mfc-串口控件的添加和使用
- poj1845 逆元,快速模幂
- 请求码(requestCode)与结果码(resultCode)解析
- 回溯法
- 易语言学习第五课
- 最简单是使用viewpager的方法