如何在C#中打印 [英] How Can I Print In C#

查看:75
本文介绍了如何在C#中打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
i有2个问题:



1-我怎么能多次打印一个礼物?



2-我有2个打印机打印机no1连接到我的电脑而另一个打印机在我的网络中

我可以在2台打印机上打印文件吗?



谢谢



这是我的代码:



hi i have 2 question :

1- how can i print a doument more than once ?

2- i have 2 printer printer no1 connect to my computer and another one is in my network
ho can i print a document in 2 printer ?

thanks

this is my code :

 String drawString = "Sample  Text";

            // Create font and brush.
            Font drawFont = new Font("Arial", 16);
            SolidBrush drawBrush = new SolidBrush(Color.Black);

            // Create rectangle for drawing. 
            float x = 350.0F;
            float y = 150.0F;
            float width = 200.0F;
            float height = 50.0F;
            RectangleF drawRect = new RectangleF(x, y, width, height);

            // Draw rectangle to screen.
            Pen blackPen = new Pen(Color.Red);
            e.Graphics.DrawRectangle(blackPen, x, y, width, height);

            // Draw string to screen.
            e.Graphics.DrawString(drawString, drawFont, drawBrush, drawRect);
            e.Graphics.DrawString(this.textBox5.Text, this.textBox1.Font, Brushes.Black, 10, 25);



private void button6_Click(object sender, EventArgs e)
        {
printdocument1.print;
}

推荐答案

1)将PrintDocument.PrinterSettings.Copies设置为您想要的副本数量。

2)你需要创建第二个PrintDocument并选择另一个打印机:据我所知,你不能同时将同一个对象发送到两个设备。如果您等待打印首先完成,您可以重复使用相同的PrintDocument对象(但我自己会使用另一个)。
1) Set the PrintDocument.PrinterSettings.Copies to the number of copies you want.
2) You would need to create a second PrintDocument and select the other printer: you can't send the same object to two devices simultaneously as far as I know. You may be able to reuse the same PrintDocument object if you wait for the print to complete first (But I'd use a second myself).


这篇关于如何在C#中打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆