如何设置或指定要打印的页数?

编程入门 行业动态 更新时间:2024-10-24 10:22:12
本文介绍了如何设置或指定要打印的页数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我创建了一个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 ?

推荐答案

在这里阅读 msdn.microsoft/en-us/library/system.drawing.printing.printersettings(v = vs.110) .aspx [ ^ ] 寻找 FromPage - ToPage 或 PrintRange 属性... Read here msdn.microsoft/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.

更多推荐

如何设置或指定要打印的页数?

本文发布于:2023-11-05 09:27:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560465.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:页数   如何设置

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!