如何设置或指定要打印的页数? [英] How can I set or specify the number of pages to be print?

查看:101
本文介绍了如何设置或指定要打印的页数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个richtextbox来输入我要打印的文本,打印命令是按钮而不是printdialog框((PrintDialog1.ShowDialog()== System.Windows.Forms.DialogResult.OK))为了显示,我创建了组合框,它将显示可用的打印机然后打印。喜欢这个代码。



获得可用的打印机:



foreach(PrinterSettings中的字符串打印机。已安装的打印机)

{

cbox.Items.Add(printer.ToString());

}



和打印按钮:



PrintDocument1.PrinterSettings.PrinterName = cbox.SelectedItem.ToString();



PrintDocument1.Print();



现在我要做的是我会添加一些文本框来输入页面要打印的号码。例如,当我要运行程序时,richtextbox中的当前页面是12页,我将在文本框中输入我想要的页面(3-7页)。怎么会这样 ?

I created a richtextbox to input the text that I want to print, the command for printing which is the button and instead of printdialog box((PrintDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)) to be display, I created combobox which will display the available printers and then print. Like this code bellow .

To get the available printers:

foreach (String printer in PrinterSettings.InstalledPrinters)
{
cbox.Items.Add(printer.ToString());
}

And the button for printing :

PrintDocument1.PrinterSettings.PrinterName = cbox.SelectedItem.ToString();

PrintDocument1.Print();

Now what I want to do is I will add some textbox to input the page number to be printed . For example the current pages in the richtextbox are 12pages when I'm going to run the program I will input in the textbox the page/s that I want like (3-7pages). How could it be ?

推荐答案

在这里阅读

http://msdn.microsoft.com/en-us/library/system.drawing.printing.printersettings(v = vs.110) .aspx [ ^ ]



寻找 FromPage - ToPage PrintRange 属性...
Read here
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printersettings(v=vs.110).aspx[^]

Look for FromPage-ToPage or PrintRange properties...


为什么要一次又一次地重新发布此问题?我已经向您展示了如何解决此问题,并为您提供了所有提供所需信息的类的链接。请去尝试做实际的工作,而不是滥用这个论坛。
Why are you reposting this question again and again? I have shown you how to solve this issue and given you links to all the classes that provide the information you need. Please go and try to do the actual work rather than abusing this forum.


这篇关于如何设置或指定要打印的页数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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