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

C# 套打Demo

于 2021-05-06 发布
0 242
下载积分: 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#队列使用示例
    【实例简介】:一个.NET自带的队列框架。按照先进选出的规则进行数据入队及出队处理。特别适合于改进某些扫表进行数据处理的场合,
    2021-08-07 00:30:58下载
    积分:1
  • YapukeB2B网站
    YapukeB2B网站
    2016-04-10下载
    积分:1
  • C# 制作的OFFICE2007皮肤的源码- 自定义皮肤代码
    C# 制作的OFFICE2007皮肤的源码
    2015-04-29下载
    积分:1
  • log4net记录 wpf程序 全局错误日志 例子源码
    log4net 记录wpf 错误日志
    2014-10-22下载
    积分:1
  • C# 树状 组织结构图 类似直销组织 源码
    C# 树状 组织结构图 类似直销组织 源码
    2013-10-03下载
    积分:1
  • WPF远程监控系统
    (1)将服务端部署到一台服务器上,然后启动OMCS.Server.exe。(2)修改客户端配置文件中的服务器的IP,在一台机器上启动客户端,登录一个帐号,比如aa01.(3)在另一台机器上启动客户端,登录另一个帐号,比如aa02.(4)aa01可以在主界面的TextBox中中输入aa02,并点击后面的按钮,来连接aa02的视频。(5)aa02也可以在其UI中输入aa01,并点击后面的按钮,来连接aa01的视频。(6)测试视讯时,两个客户端最好在不同的房间。(7)测试白板时,需要连接到同一个用户的白板,才能协同。
    2017-03-02下载
    积分:1
  • 抓包 程序 实例源码下载
    WinPcap过滤表达式检验程序
    2014-07-11下载
    积分:1
  • winform中使用 Jquery 读取网页内容 源码下载,(思路可借鉴)
    winform中使用 Jquery 读取网页内容 源码下载,(思路可借鉴)
    2014-06-07下载
    积分:1
  • DES加密解密/AES加密解密/RSA加密解密/SHA1/MD5 例子
    DES加密解密/AES加密解密/RSA加密解密/SHA1/MD5 例子
    2016-10-19下载
    积分:1
  • 小滴课堂C课程笔记.pdf
    目录 第一章 C语言课程内容介绍 第二章 你真的了解C语言吗? 第三章 编写你的第一个C程序 第四章 C语言基础语法和数据类型 第五章 深入理解C语言运算符与表达式 第六章 C语言核心基础知识之控制流 第七章 C语言核心基础知识之数组 第八章 C语言核心基础知识之函数 第九章 C语言面试必问知识点之指针 第十章 C语言核心数据结构 第十一章 C语言高级核心之大话预处理 第十二章 玩转C语言高级知识点之文件 第十三章 C语言实战篇之学生管理系统 第十四章 C语言课程内容总结
    2021-08-07 00:30:59下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载