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

C# 套打Demo

于 2021-05-06 发布
0 239
下载积分: 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 个回复

  • C# listview 扩展 示例源码
    C# listview 扩展 示例源码
    2013-10-02下载
    积分:1
  • Sql CE Helper类源码下载
    Sql CE Helper类源码下载
    2014-01-22下载
    积分:1
  • C# 网络爬虫
    测试了下:抓取单页没事,批量抓取暂时没发现在哪里。。。 网络爬虫程序源码这是一款用 C# 编写的网络爬虫主要特性有: 可配置:线程数、线程等待时间,连接超时时间,可爬取文件类型和优先级、下载目录等。状态栏显示统计信息:排入队列URL数,已下载文件数,已下载总字节数,CPU使用率和可用内存等。有偏好的爬虫:可针对爬取的资源类型设置不同的优先级。健壮性:十几项URL正规化策略以排除冗余下载、爬虫陷阱避免策略的使用等、多种策略以解析相对路径等。较好的性能:基于正则表达式的页面解析、适度加锁、维持HTTP连接等。今后有空可能加入的特性:新特性 介绍 爬取文件用Berkeley DB存储 提高性能: 常用操作系统不善于处理大量小文件 基于URL Ranking的优先级队列 主题爬虫: 机器学习算法对链接与主题相关度进行评估,并按照得出的优先级顺序进行爬取 爬虫礼仪 遵循爬虫禁止协议、以及避免对服务器资源的过度使用等 性能优化 用UDP取代封装好的HttpWebRequest/ResponseDNS缓存异步的DNS地址解析硬盘缓存或内存数据库以避免频繁的磁盘寻道分布式爬虫以扩展单机能力(CPU、内存和硬盘访问)            
    2015-09-14下载
    积分:1
  • AsposePdf,C#,PDF批量转TXT,识别PDF内容批量修改PDF文件名称
    【实例简介】AsposePdf.dll,PDF批量转TXT,识别PDF内容批量修改PDF文件名称;
    2021-05-18 10:33:18下载
    积分:1
  • 冒泡排序+输出
    【实例简介】冒泡排序 输出
    2021-08-16 00:30:53下载
    积分:1
  • winform 上传文件 实例源码
    工作中用到winform上传文件(-_-!,很少用winform,搞了半天)碰到一点问题,解决如下1、501 为实现错误解决方法:先把IISWEB服务扩展中的WebDev打开然后IIS站点添加MIME  txt类型 常见的MIME类型如下超文本标记语言文本 .html,.htmltext/html普通文本 .txt text/plainRTF文本 .rtfapplication/rtfGIF图形 .gif image/gifJPEG图形 .ipeg,.jpgimage/jpegau声音文件 .au audio/basicMIDI音乐文件 mid,.midiaudio/midi,audio/x-midiRealAudio音乐文件 .ra, .ramaudio/x-pn-realaudioMPEG文件 .mpg,.mpegvideo/mpegAVI文件 .avivideo/x-msvideoGZIP文件 .gzapplication/x-gzipTAR文件 .tarapplication/x-tar再然后设置目标文件夹的可写性
    2015-06-17下载
    积分:1
  • C# 文件压缩 例子源码
    c#文件压缩,代码可以修改使用
    2017-11-28下载
    积分:1
  • 微信自动回复 asp.net
    微信自动回复 asp.net
    2014-04-14下载
    积分:1
  • TCPIP编写的聊天服务器客户端
    【实例简介】TCPIP编写的聊天服务器客户端
    2021-12-29 00:31:27下载
    积分:1
  • C#+Winform+3层开发结构操作.txt文件信息(增删改查)
    用C# Winform 3层开发结构操作.txt文件信息(增删改查),要操作的.txt文件在DBUtxt.UIDBUtxt.UIinDebug中,项目里可以找到。
    2017-04-22下载
    积分:1
  • 696516资源总数
  • 106927会员总数
  • 1今日下载