6.30 winform 打印

 1 using System;
 2 using System.Collections.Generic;
 3 using System.ComponentModel;
 4 using System.Data;
 5 using System.Drawing;
 6 using System.Linq;
 7 using System.Text;
 8 using System.Windows.Forms;
 9
10 namespace _6._30_下午打印
11 {
12     public partial class Form1 : Form
13     {
14         public Form1()
15         {
16             InitializeComponent();
17         }
18
19         private void Form1_Load(object sender, EventArgs e)
20         {
21
22         }
23       //页面设置
24         private void 打印设置ToolStripMenuItem_Click(object sender, EventArgs e)
25         {
26             pageSetupDialog1.Document = printDocument1;
27             pageSetupDialog1.ShowDialog();
28
29         }
30
31         private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
32         {
33
34             Font f=new Font("楷体",14);//字体
35             Brush b=new SolidBrush(Color.Black);  //画刷
36             PointF p=new PointF(10,10);//定义位置具有XY轴,(10,10)左+上
37             e.Graphics.DrawString(textBox1.Text, f, b, p);//格式刷
38         }
39
40
41         //打印预览
42         private void 打印预览VToolStripMenuItem_Click(object sender, EventArgs e)
43         {
44
45          // printPreviewControl1.Document = printDocument1;
46             printPreviewDialog1.Document = printDocument1;
47             printPreviewDialog1.ShowDialog();
48
49
50         }
51
52         //打印
53
54         private void 打印PToolStripMenuItem_Click(object sender, EventArgs e)
55         {
56             printPreviewDialog1.Document = printDocument1;
57             printDialog1.ShowDialog();
58             //打印步骤:(1)页面设置(2)打印预览(3)打印
59         }
60
61     }
62 }
时间: 2024-08-12 18:29:27

6.30 winform 打印的相关文章

Winform 打印PDF顺序混乱,获取打印队列

原文:Winform 打印PDF顺序混乱,获取打印队列 工作中PDF打印顺序混乱着实让我疼痛了好久,其实决绝方法非常简单,但没有想到这个点子的时候确实让我走了很多弯路 这里文章写出来并不是为了炫耀什么,只是觉得发现些好东西就分享出来而已,同时也做个记录,方便以后查找 开始正文 既然要解决打印顺序混乱,那么必须先要实现打印PDF功能,实现PDF打印的方法很多,网上随便一搜就可以找到,这里我贴上自己的打印方法,其实也是网上找到的,稍稍做了修改 Process proc = new Process()

【2017-05-03】winform打印控件、事件对象和事件数据、MDI窗体容器

一.打印控件 第一步先把打印对象搞出来. - printDocument    打印对象(将要打印的内容放到该对象里,从该对象里取内容打印) 设置他的PrintPage事件(对于要打印的每一页触发一次) - pageSetupDialog 打印设置对话框 - printPreviewDialog 打印预览对话框 - printPreviewControl  打印预览控件. 只需要把预览对象给他设置上就好 - printDialog  打印对话框 打印界面里面是否禁用页面范围.打印到文件等从Pri

winform 打印小票

后台代码 1 panPrintContent.Visible = true; 2 var strlPrinterMode = ""; 3 4 this.pageSetupDialog1.PageSettings.Margins.Left = 1; 5 this.pageSetupDialog1.PageSettings.Margins.Top = 1; 6 this.pageSetupDialog1.PageSettings.Margins.Right = 21; 7 this.pag

C# winform打印总结 z

http://blog.csdn.net/jing_xin/article/details/41444063 针对BEIYANG收据打印机 BTP-R580测试通过. 操作说明:http://www.docin.com/p-395110672.html 1.一般的打印 static Font printFont; //打印使用的字体         public static void PrintEventPage(object sender, PrintPageEventArgs e)    

winform 打印

pageSetupDialog 打印设置,和对话框控件差不多的套路,把控件拖到窗口中后,会在下方显示, 然后在制作的菜单中找到打印设置,双击进入点击事件写代码 按照之前的套路, DialogResult drr = pageSetupDialog1.ShowDialog(); if (drr == DialogResult.OK) { } 执行的时候会报错,,就是说问题出现在页面设置,document(类似于一个文档的对象) 在打开打印设置的对话框之前要先告诉它要设置的是什么内容,才能让他把页面

6.30 winform 对话框控件

1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.IO; 7 using System.Linq; 8 using System.Text; 9 using System.Windows.Forms; 10 11 namespace _6._30_上午_对话框控件

winform 打印控件

(1)PageSetupDialog1    打印设置窗口  (2)PrintDocument     向打印机输送的对象 事件:PrintPage   对于打印的每一页都执行一次 (3)PrintPreviewControl     打印预览,在本窗口中预览,不包含任何对话框和按钮 (4)PrintPreviewDialog     打印预览,弹出一个预览窗口 (5)PrintDialog     打印   弹出打印窗口可选择打印机和任何打印项设置 //对于打印的每一页都执行一次 privat

【2017-5-3】Winform 打印控件

打印控件:要打印,第一步先要想到制作打印对象 private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { Font f = new Font("黑体",20); Brush b = new SolidBrush(Color.Red); e.Graphics.DrawString(textBox1.Text, f, b, 20, 50); } 通过

【笔试】30、打印1到最大的n位数

/** *题目:输入数字n,按顺序打印从1最大的n位十进制数,比如输入3,则打印出1.2.3一直到最大的3位数即999. *时间:2015年8月29日09:32:48 *文件:MaxOfNDigits_1.java *作者:cutter_point */ package bishi.Offer50.y2015.m08.d29; import org.junit.*; public class MaxOfNDigits_1 { /** * 打印出来这些数 * @param n */ public