资源简介
C#打印实例-全部打印源码实例

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Collections;
namespace AllPrint
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
#region 定义全局对象及变量
int intPage = 0;//总页数
int intRows = 30;//每页行数
int EndRows = 0;//最后一页函数
int currentpageindex = 1;//当前打印页
Pen myPen = new Pen(Color.Black);
Font myFont = new Font(“宋体“ 9);//字体
Brush myBrush = new SolidBrush(Color.Black);//画刷
int PrintPageHeight = 1169;//打印的默认高度
int PrintPageWidth = 827;//打印的默认宽度
int topmargin = 60; //顶边距
int rowgap = 32;//行高
int leftmargin = 50;//左边距
int rightmargin = 50;//左边距
int buttommargin = 80;//底边距
int columnWidth1 = 57;//第一列宽度
int columnWidth2 = 335;//第二列宽度
#endregion
//加载数据
private void Form1_Load(object sender EventArgs e)
{
SqlConnection sqlcon = new SqlConnection(“Data Source=.;Database=db_04;Uid=sa;Pwd=1;“);
SqlDataAdapter sqlda = new SqlDataAdapter(“select IDNameSex from tb_Student“ sqlcon);
DataSet myds = new DataSet();
sqlda.Fill(myds);
dataGridView1.DataSource = myds.Tables[0];
EndRows = (dataGridView1.Rows.Count-2) % intRows;//去掉标题和最后一行的空行
if (EndRows > 0)
intPage = Convert.ToInt32((dataGridView1.Rows.Count - 2) / intRows) + 1;
else
intPage = Convert.ToInt32((dataGridView1.Rows.Count - 2) / intRows);
label1.Text = “共有“ + (dataGridView1.Rows.Count - 2) + “条数据 共“ + intPage + “页“;
}
//打印
private void button2_Click(object sender EventArgs e)
{
printPreviewDialog1.ShowDialog();
}
//对打印文档进行设置
private void printDocument1_PrintPage(object sender System.Drawing.Printing.PrintPageEventArgs e)
{
if (dataGridView1.Rows.Count > 0)
{
PrintPageWidth = e.PageBounds.Width;//获取打印线张的宽度
PrintPageHeight = e.PageBounds.Height;//获取打印线张的高度
#region 绘制边框线
e.Graphics.DrawLine(myPen leftmargin topmargin PrintPageWidth - leftmargin - rightmargin topmargin);
e.Graphics.DrawLine(myPen leftmargin topmargin leftmargin PrintPageHeight - topmargin - buttommargin);
e.Graphics.DrawLine(myPen leftmargin PrintPageHeight - topmargin - buttommargin PrintPageWidth - leftmargin - rightmargin PrintPageHeight - topmargin - buttommargin);
e.Graphics.DrawLine(myPen PrintPageWidth - leftmargin - rightmargin topmargin PrintPageWidth - leftmargin - rightma
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4081 2019-02-22 12:16 C#打印实例-全部打印源码实例\AllPrint\AllPrint.csproj
文件 24064 2019-02-22 12:25 C#打印实例-全部打印源码实例\AllPrint\bin\Debug\AllPrint.exe
文件 34304 2019-02-22 12:25 C#打印实例-全部打印源码实例\AllPrint\bin\Debug\AllPrint.pdb
文件 11608 2019-02-22 12:25 C#打印实例-全部打印源码实例\AllPrint\bin\Debug\AllPrint.vshost.exe
文件 490 2013-03-18 17:00 C#打印实例-全部打印源码实例\AllPrint\bin\Debug\AllPrint.vshost.exe.manifest
文件 5476 2019-02-22 12:25 C#打印实例-全部打印源码实例\AllPrint\Form1.cs
文件 6523 2019-02-22 12:25 C#打印实例-全部打印源码实例\AllPrint\Form1.designer.cs
文件 21736 2019-02-22 12:25 C#打印实例-全部打印源码实例\AllPrint\Form1.resx
文件 1840 2019-02-22 12:25 C#打印实例-全部打印源码实例\AllPrint\obj\Debug\AllPrint.csproj.FileListAbsolute.txt
文件 847 2019-02-22 12:25 C#打印实例-全部打印源码实例\AllPrint\obj\Debug\AllPrint.csproj.GenerateResource.Cache
文件 24064 2019-02-22 12:25 C#打印实例-全部打印源码实例\AllPrint\obj\Debug\AllPrint.exe
文件 10728 2019-02-22 12:25 C#打印实例-全部打印源码实例\AllPrint\obj\Debug\AllPrint.Form1.resources
文件 34304 2019-02-22 12:25 C#打印实例-全部打印源码实例\AllPrint\obj\Debug\AllPrint.pdb
文件 180 2019-02-22 12:16 C#打印实例-全部打印源码实例\AllPrint\obj\Debug\AllPrint.Properties.Resources.resources
文件 789 2019-02-22 12:16 C#打印实例-全部打印源码实例\AllPrint\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6158 2019-02-22 12:25 C#打印实例-全部打印源码实例\AllPrint\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 4608 2019-02-22 12:16 C#打印实例-全部打印源码实例\AllPrint\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 489 2009-01-16 15:55 C#打印实例-全部打印源码实例\AllPrint\Program.cs
文件 1372 2009-01-16 15:55 C#打印实例-全部打印源码实例\AllPrint\Properties\AssemblyInfo.cs
文件 2856 2019-02-22 12:16 C#打印实例-全部打印源码实例\AllPrint\Properties\Resources.Designer.cs
文件 5612 2009-01-16 15:55 C#打印实例-全部打印源码实例\AllPrint\Properties\Resources.resx
文件 1108 2019-02-22 12:16 C#打印实例-全部打印源码实例\AllPrint\Properties\Settings.Designer.cs
文件 249 2009-01-16 15:55 C#打印实例-全部打印源码实例\AllPrint\Properties\Settings.settings
文件 914 2019-02-22 12:16 C#打印实例-全部打印源码实例\AllPrint.sln
..A..H. 19456 2019-02-22 12:25 C#打印实例-全部打印源码实例\AllPrint.suo
文件 3762 2009-01-16 15:56 C#打印实例-全部打印源码实例\Backup\AllPrint\AllPrint.csproj
文件 5501 2009-01-16 15:59 C#打印实例-全部打印源码实例\Backup\AllPrint\Form1.cs
文件 5659 2009-01-16 15:58 C#打印实例-全部打印源码实例\Backup\AllPrint\Form1.designer.cs
文件 21736 2009-01-16 15:58 C#打印实例-全部打印源码实例\Backup\AllPrint\Form1.resx
文件 489 2009-01-16 15:55 C#打印实例-全部打印源码实例\Backup\AllPrint\Program.cs
............此处省略32个文件信息
相关资源
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
评论
共有 条评论