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

C# 套打Demo

于 2021-05-06 发布
0 275
下载积分: 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++ 串口 发送消息、接收消息实例源代码(支持2进制、ASCII码、16进制)
    VC 串口通讯源代码
    2019-10-27下载
    积分: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
  • c++ 制作 万年历 实例源码(C语言基础巩固与提高)
                        巩固C语言基础,开发的万年历程序。
    2019-06-02下载
    积分:1
  • 学时选课系统源码(含课程设计报告)
    【实例简介】 题目:学生选修课程系统设计 功能:假定有n门课程,每门课程有课程编号,课程名称,课程性质,总学时,授课学时,实验或上机学时,学分,开课学期等信息。试设计一选修课程系统。 分步实施: 1、初步完成总体设计,搭好框架,确定人机对话界面,确定函数个数; 2、建立一个文件,将每条记录信息写入文件中并能显示于屏幕上 3、完成上述添加、查找(课程编号、课程名称、课程性质等)、修改等功能。 4、进一步要求:学生选修课程(可选项) 要求:1、用C 语言实现程序设计; 2、利用结构体(或类)数组实现信息的数据结构设计; 3、系统的各个功能模块要求用函数的形式实现; 4、界面友好(良好的人机交互),程序加必要的注释。 课程设计实验报告要求: 1、预习报告:题目、课程设计任务、数据结构、程序的总体设计(算法)、模块划分 。 2、实验总结报告:流程图、主要源程序代码(需打印)、测试情况及调试中问题与解决方案、小结等。
    2021-05-30 00:31:16下载
    积分:1
  • winform 显示gif动画 示例源码下载
    winform 显示gif动画 示例源码下载
    2014-03-05下载
    积分:1
  • VS2017真正免注册调用大漠插件示例
    VS2017真正免注册调用大漠插件示例
    2019-07-07下载
    积分:1
  • c++猜数小游戏源码(入门级)
    c++猜数小游戏源码(入门级)
    2020-04-19下载
    积分:1
  • c# dns查询 实例源码下载
    c# dns查询 实例源码下载
    2015-01-16下载
    积分:1
  • C# webqq 登录 例子源码
    思路可借鉴,现已不能用,应该是网址变了,提示有病毒,不过没病毒 测试过了
    2014-10-29下载
    积分:1
  • C# 农历 操作常用类 源码
    C# 农历 操作常用类 源码
    2014-06-11下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载