zoukankan      html  css  js  c++  java
  • winform 打印控件

    打印控件执行前需先创建打印对象

    1、PrintDocument:打印对象

    (1)、构造函数初始打印对象

    pageSetupDialog1.Document = printDocument1;

    (2)、创建打印对象内容

    2、PageSetupDialog:打印页面设置

    复制代码
    private void 页面设置ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                pageSetupDialog1.Document = printDocument1;
                DialogResult dr = pageSetupDialog1.ShowDialog();
                if (dr == DialogResult.OK)
                { }
            }
    复制代码

    3、PrintPreviewDialog:打印预览

    4、PrintPreviewControl:页面显示打印预览

    复制代码
     private void 打印预览VToolStripMenuItem_Click(object sender, EventArgs e)
            {
                printPreviewControl1.Document =printDocument1;
                printPreviewDialog1.Document = printDocument1;
                DialogResult dr = printPreviewDialog1.ShowDialog();           
                if(dr==DialogResult.OK)
                {}
            }
    复制代码

    5、PrintDialog:打印

    复制代码
     private void 打印PToolStripMenuItem_Click(object sender, EventArgs e)
            {
                printDialog1.Document = printDocument1;
                DialogResult dr = printDialog1.ShowDialog();
                if(dr==DialogResult.OK)
                {
                    printDocument1.Print();
                }
            }
    复制代码
  • 相关阅读:
    day70 django中间件
    day69 cookie与session
    day68 form组件
    day67 前后端数据交互
    day65 django进阶(1)
    day64 django模型层
    day63 django入门(4)
    day62 作业
    Python正课142 —— DRF 进阶3 路由与认证
    一文搞懂什么是IaaS, PaaS和SaaS
  • 原文地址:https://www.cnblogs.com/changxiaosen/p/6956799.html
Copyright © 2011-2022 走看看