登录
首页 » C# » C# 套打Demo

C# 套打Demo

于 2021-05-06 发布
0 247
下载积分: 1 下载次数: 0

代码说明:

套打Demo 【核心代码】using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Drawing.Printing;namespace Print_Demo{ public partial class Form1 : Form { public PrintDocument printDt = new PrintDocument(); //打印文档对象 Font printFont; //打印使用的字体 public Form1() { InitializeComponent(); } void printDt_PrintPage(object sender, PrintPageEventArgs e) { float pointX = 10; float pointY = 10; e.Graphics.DrawString("打印内容", new Font("宋体", 16F), Brushes.Black, pointX 60, pointY); e.Graphics.DrawLine(new Pen(Color.Black), pointX, pointY 26,pointX 300,pointY 26); e.Graphics.DrawString("打印内容", printFont, Brushes.Black, pointX, pointY 35); e.Graphics.DrawLine(new Pen(Color.Black), pointX, pointY 56, pointX 300, pointY 56); e.Graphics.DrawString("打印内容", printFont, Brushes.Black, pointX, pointY 65); e.Graphics.DrawLine(new Pen(Color.Black), pointX, pointY 86, pointX 300, pointY 86); e.Graphics.DrawString("打印内容", printFont, Brushes.Black, pointX, pointY 95); e.Graphics.DrawLine(new Pen(Color.Black), pointX, pointY 116, pointX 300, pointY 116); e.Graphics.DrawString("打印内容", printFont, Brushes.Black, pointX, pointY 125); e.Graphics.DrawLine(new Pen(Color.Black), pointX, pointY 146, pointX 300, pointY 146); e.Graphics.DrawString("打印内容", printFont, Brushes.Black, pointX, pointY 155); e.Graphics.DrawLine(new Pen(Color.Black), pointX, pointY 176, pointX 300, pointY 176); e.Graphics.DrawString("打印内容", printFont, Brushes.Black, pointX, pointY 185); e.Graphics.DrawLine(new Pen(Color.Black), pointX, pointY 206, pointX 300, pointY 206); e.Graphics.DrawString("检测结果", printFont, Brushes.Black, pointX, pointY 233); e.Graphics.DrawString("通过", new Font("宋体",22F,FontStyle.Bold), Brushes.Black, pointX 90, pointY 225); e.Graphics.DrawLine(new Pen(Color.Black), pointX, pointY 265, pointX 300, pointY 265); e.Graphics.DrawString("单位名称", printFont, Brushes.Black, pointX, pointY 275); } private void Form1_Load(object sender, EventArgs e) { printDt.PrintPage = new PrintPageEventHandler(printDt_PrintPage); printFont = new Font("宋体", 12F); } private void btnPrint_Click(object sender, EventArgs e) { //PrintDialog printDlg = new PrintDialog(); //printDlg.Document = printDt; //printDlg.AllowPrintToFile = true; //printDlg.AllowCurrentPage = true; //printDlg.AllowSelection = true; //printDlg.ShowDialog(); //printDlg.ShowDialog(); printDt.Print(); } private void btnLook_Click(object sender, EventArgs e) { PrintPreviewDialog printPreview = new PrintPreviewDialog(); printPreview.PrintPreviewControl.Document = printDt; printPreview.ShowDialog(this); } }}

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • NBearLite数据持久化 demo源码
    NBear是一个基于.Net 2.0、C#2.0开放全部源代码的的软件开发框架类库。
    2013-08-04下载
    积分:1
  • adsl拨号示例源码下载 有截图
    adsl拨号示例源码下载 有截图
    2020-10-21 02:47:24下载
    积分:1
  • AutoCAD .net 二次开发源码 下载
    用VS.NET2005开发ObjectARX程序 调试方法1.自动启动AutoCAD:选择工程根目录(解决方案下面的),鼠标右键-->属性-->工程属性对话框-->调试标签-->启动操作:启动外部程序-->浏览选择AutoCAD的安装目录,选择acad.exe。2.手动加载类库:(1) 按F5;(2) 自动启动AutoCAD,一路继续。(3) 在CAD命令行手动输入"netload",浏览到自己的动态连接库文件。3.自动加载类库:(1) 工程属性对话框-->调试标签-->启动选项-->命令行参数中输入:/nologo /b "....start.scr"让CAD自动在命令执行工程目录里的start.scr文件。(2) 然后就是在工程目录的根目录创建一个文本文件,名字取为“start.scr”,并在此文件中输入如下文本:netload "....indebuglubanren_2008.dll" (3) 按F5。4.单纯的数据库交互窗体操作,使用Windows 应用程序开发模式调试会更方便些:(1) 工程属性对话框-->应用程序标签-->程序集名称:Windows 应用程序。(2) 调试标签-->启动操作:启动项目。(3) 按F5。
    2013-08-30下载
    积分:1
  • C# WinFrom 实现的FTP上传下载
    C# WinFrom 实现的FTP上传下载
    2020-05-13下载
    积分:1
  • <免安装版>sqlite 数据库操作 实例源码下载
    如果你的操作系统是 win64位系统,那么请按照以下提示操作: 首先在这里下载  最新版的 sqlite dll文件,引用到项目中 http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki 记住是这个版本:Precompiled Binaries for 64-bit Windows  以及对应上你的 .net framework环境即可  另外程序的版本修改成 x64, 右键项目>>生成>>目标平台选择 x64 即可 至此即可使用  据说:从 System.Data.SQLite, Version=1.0.94.0 这个版本以后 不需要引用SQLite.Interop.dll 这个了,包含到 system.data.sqlite.dll中了
    2015-04-12下载
    积分:1
  • ComboBox 绑定List ArrayList 数据源示例源码- 自定义类(多字段) DisplayMember
    msdn说: DisplayMember is set to the comboBox control, it uses the default ToString of the object,
    2014-08-24下载
    积分:1
  • facebook OAuth 2.0 asp.net
    facebook OAuth 2.0 asp.net
    2013-05-23下载
    积分:1
  • pop3client 读取邮件内容完整实例 有截图有源码下载
    利用 LumiSoft.Net实现 读取邮件内容实例                               
    2013-07-28下载
    积分:1
  • 最小覆盖圆问题(c++代码)
    :输入N个点的坐标,求一个能覆盖全部点 的最小圆
    2020-05-24下载
    积分:1
  • 屏幕取色 取色器源码
    屏幕取色 取色器源码
    2013-10-28下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载