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

C# 套打Demo

于 2021-05-06 发布
0 205
下载积分: 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和C++ 实现的CRC24a校验码的生成.rar
    用C和C++ 实现的CRC24a校验码的生成.rar
    2019-03-14下载
    积分:1
  • Unity 粒子效果
    unity中粒子系统的粒子,完整样例,来自unity官方指定用书第五章光盘自带例子。粒子特效能够为游戏增添交互与响应能力,它们擅长创造许多运动和撞击效果。粒子特效可用于创建魔法火球,漩涡状的空间传送门,或者将玩家的注意力引导到一个发光的宝箱。炫酷的视觉效果往往引人入胜。
    2019-03-23下载
    积分:1
  • 单片机ADC实例
    【实例简介】51单片机ADC
    2021-07-03 00:31:25下载
    积分:1
  • C++实战源码-绘制滑标控件(入门级实例329).zip
    C++实战源码-绘制滑标控件(入门级实例329).zip
    2019-10-01下载
    积分:1
  • C# 快递费用计算软件 源码
         switch (aa)            {                case "香港":                    float a;                    a = float.Parse(textBox1.Text);                    // textBox1.Text = a.ToString();                    if (a 1)                    {                        float b = a % 1;                        float c = a - b;                        if (b 0.5)                        {                            double res;                            res = c * 25 30;                            label3.Text = res.ToString();                        }                    }                     break;
    2014-09-10下载
    积分:1
  • <赞>C# 超市管理系统源码
    功能齐全的超市管理系统,专门美化过UI 请先附加数据库,否则无法进入系统(默认拥有最高权限账户为经理,密码为admin  压缩包内有使用说明!
    2018-06-10下载
    积分:1
  • Winform中鼠标穿透效果,类似桌面壁纸的效果
    鼠标穿透效果实例,可实现类似桌面浮动效果,详见截图
    2013-01-11下载
    积分:1
  • C#欧姆龙Fins_TCP通信
    【实例简介】
    2021-08-05 00:30:59下载
    积分:1
  • C#控制雷赛驱动器单轴点位运动
    C#控制雷赛驱动器单轴点位运动
    2020-11-29下载
    积分:1
  • CRC校验(modbus)
    /CRC16_MODBUS:多项式x16 x15 x5 1(0x8005),初始值0xFFFF,低位在前,高位在后,结果与0x0000异或unsigned short do_crc(unsigned char *ptr, int len) {     unsigned int i;     unsigned short crc = 0xFFFF;  //crc16位寄存器初始值     while(len--)     {         crc ^= *ptr ;         for (i = 0; i > 1) ^ 0xA001; //多项式 POLY(0x8005)的高低位交换值,这是由于其模型的一些参数决定的             else                 crc = (crc >> 1);         }     }     return crc; }
    2021-05-06下载
    积分:1
  • 696518资源总数
  • 106155会员总数
  • 8今日下载